What does “insertAdjacentHTML doesn't corrupt the existing DOM” mean?

insertAdjacentHTML() doesn’t corrupt what’s already in the DOM.

I just read this on the Mozilla blog about the implementation of insertAdjacentHTML(). What does it mean ?

Answers:

Answer

It means it doesn't serialise the DOM inside the element to HTML, append the new HTML, then generate a new DOM from that (which would create new elements, breaking references, event handlers, etc).

Answer

insertAdjacentHTML() parses the specified text as HTML or XML and inserts the resulting nodes into the DOM tree at a specified position

https://developer.mozilla.org/en/DOM/element.insertAdjacentHTML

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.