DEV Community

Discussion on: Vanilla JavaScript and HTML - No frameworks. No libraries. No problem.

Collapse
 
assainov profile image
Ilyas Assainov

With the 3rd approach I had a bug in IE11.

Usually the content inside tag is defended by shadow DOM, so that if you want to querySelect those elements in subsequent interactions, template stays immutable in the DOM. For example, you use template content with Load more button. Template should always be original. But IE11 doesn't really defend elements inside template tag, so if you decide to querySelector(..).parentElement.removeChild(), IE will get those templates and it will delete them, causing unpredictable behaviour!

What helped is replacing tag with .... That way IE11 won't even touch the so called template.