andrei
andrei

Reputation: 8582

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 ?

Upvotes: 1

Views: 186

Answers (2)

Andrew D.
Andrew D.

Reputation: 8220

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

Upvotes: 0

Quentin
Quentin

Reputation: 943214

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).

Upvotes: 4

Related Questions