You're still reaching for jQuery — or 200 lines of vanilla — to do things the browser now does in one line.
6 modern DOM patterns: querySelector + closest, classList, DocumentFragment, replaceChildren, event delegation, and AbortController.
Vanilla JavaScript · zero dependencies · Baseline in every major browser · 2026.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The 6 patterns (one per minute):
· #3 DocumentFragment — batch 1000 inserts into ONE reflow instead of 1000 (the perf win, shown live)
· #1 querySelector + querySelectorAll — one API, any CSS selector; static NodeList vs live HTMLCollection; closest() instead of parentNode chains
· #2 classList — add / remove / toggle (with the boolean force-arg) instead of the className += ' x' whitespace bug
· #4 replaceChildren — why innerHTML kills listeners and opens an onerror XSS hole, and how nodes-or-strings fixes it
· #5 Event delegation — one listener on the parent + event.target.closest, works for items added later
· #6 AbortController — pass one signal to every addEventListener, then controller.abort() removes them all
Plus the honest part: when innerHTML, className =, and manual removeEventListener are still totally fine.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Channel: Pixel Grid UI — practical CSS / JavaScript / web-platform breakdowns. One deep dive every Monday.
🔔 Comment 'modernized' if you run the Monday cleanup (Cmd+Shift+F for .appendChild in a loop, innerHTML =, and listeners with no removal).
Follow:
· Instagram → @pixelgridui
· Codepen → @pixelgridui
00:00 The 6 patterns (and why they replaced jQuery)
00:41 The perf trap — appendChild in a loop
01:21 #3 DocumentFragment — 1000 inserts, 1 reflow
02:30 #1 querySelector + closest()
03:20 #2 classList — kill the className += bug
04:07 #4 replaceChildren — innerHTML's XSS trap
05:18 #5 + #6 delegation + AbortController
06:35 When the old way is still fine
07:28 Recap + your Monday commit
#VanillaJS #DOMManipulation #JavaScript
On this page of the site you can watch the video online JavaScript DOM Manipulation: 6 Patterns That Replace jQuery with a duration of hours minute second in good quality, which was uploaded by the user Pixel Grid UI 07 June 2026, share the link with friends and acquaintances, this video has already been watched 4,091 times on youtube and it was liked by 286 viewers. Enjoy your viewing!