ACTUAL DOM changes are already batched until scripting ends. IF you removeChild, appendChild, or insertBefore actual Nodes, none of them will cause a reflow until the script returns control to the browser.

The asshat hoops I've seen people jump through to "batch their changes" is just such utter nonsense, and bespeaks bad planning and a lack of comprehending how JS even works.

But to be fair, 90%+ (excuse me pulling a percentage out my backside) of what people CALL working with the DOM isn't. innerHTML and textContent are not "working with the DOM". Creating a nodelist with querySelector/querySelectorAll/getElement(s)ByWhatever is NOT "working with the DOM".

Walking the DOM, creating and removing nodes, that's DOM manipulation and it's so much faster than other techniques, you don't have to "avoid it".

It's funny how people seem so afraid of the DOM. It's not like she has a whip.

Though rest of your article is "back to basics" common sense. Something sorely lacking right now. We have people actually saying "what's a few more lines" and "speed doesn't really matter"... just like how they don't understand what's wrong with lacking scripting off graceful degradation and how it tells large swaths of users -- like the disabled -- to go plow themselves.

There needs to be more discussion about speed and efficiency, and a LOT of the junk being heaped into the newer ECMA specifications just aren't it.

Written by

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