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 ?
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).
insertAdjacentHTML() parses the specified text as HTML or XML and inserts the resulting nodes into the DOM tree at a specified position
©2020 All rights reserved.