Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What's wrong with using innerHTML?


Primarily, memory leaks

You can find better reasons here http://ajaxian.com/archives/the-problem-with-innerhtml


Several bugs and issues, some things don't work, issues with tables...

Not to mention the fact it just looks ugly and horrible IMHO.

Setting innerHTML to a string, in order to deserialize a partial HTML fragment is just not nice.

The DOM methods are actually pretty well thought out, and provide a far better interface to manipulate the document.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: