Your ENTIRE DOM section makes me wonder if you even know what the DOM is, or how it works... or if you're just another of these people who think that DOM manipulation begins/ends at getElement(s)By(whatever) and/or querySelector(all)... which are the ONLY things that are slow, and aren't actual DOM manipulation.

Walking the DOM is fast. CreateElement/CreateTextNode/appendChild/insertBefore are FAST because they bypass the parser. The changes made as such are instantaneous because they directly manipulate the live DOM tree, with their render changes not occurring until scripting execution is released... (which is why that "Batch your changes" LIE is a bunch of halfwit malarkey in most cases)

That you're screwing around with ASYNC/DEFER, messing with minor aspects like class changes... Which are slow in your case because classList is based on JS' slow iterable-likes, not the DOM)

No joke, classList.add / remove / etc are actually slower than even regex on Element.className just because classList is an iterable... and with JavaScript pretending its pointered list objects are arrays, they're slow as molasses in February.

Where's DOM walking/traversal? Where's actual DOM manipulation? The blanket claim about speed is meaningless if you don't actually show ACTUAL DOM manipulation!

Particularly the "each is done one at a time" tripe... yeah, that's how JavaScript works.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store