Wesley Aptekar-Cassels personal blog

GetElementById vs. QuerySelector

A while ago, I was curious how the speed of document.getElementById compared to document.querySelector in Javascript for selecting a single element by ID. querySelector has to do a lot more work, so one would expect that it would be slower, but I didn't know if the difference was enough to care about.
Points
147
HN comments
94
Submissions
1
Cited by
0 commenters

Web & FrontendSoftware Engineering2021

On Hacker News

SubmittedTitle on HNPointsComments
Nov 26, 2021GetElementById vs. QuerySelector by wesleyac14794

More from Wesley Aptekar-Cassels

All 13 posts →

Related posts from the same era