Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
exizt88
on Jan 30, 2014
|
parent
|
context
|
favorite
| on:
You might not need jQuery
What?
> $('<div>').append($(el).clone()).html()
vs
> el.outerHTML
Why not $(el)[0].outerHTML?
zabraxias
on Jan 30, 2014
[–]
What if $(el).length === 0?
exizt88
on Jan 30, 2014
|
parent
[–]
This check is required in both cases. el.outerHTML assumes that el is not NULL (which it could be as a result of getElementById, for example).
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
> $('<div>').append($(el).clone()).html()
vs
> el.outerHTML
Why not $(el)[0].outerHTML?