Hacker News new | past | comments | ask | show | jobs | submit login

What?

> $('<div>').append($(el).clone()).html()

vs

> el.outerHTML

Why not $(el)[0].outerHTML?




What if $(el).length === 0?


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: