News for hackers. Stuff that matters.
Re:GetElementById vs. QuerySelector by sillysaurusx on Thursday November 25, 2021 @10:58PM (#29347374)
What an awful design. Why would it differ like that? No doubt some legacy baggage that was later turned into a justification.
Re:GetElementById vs. QuerySelector by jayflux on Friday November 26, 2021 @03:58AM (#29348522)
These APIs didn’t all come out the same time, so they weren’t designed to differ.

Instead they decided against doing live node lists in future but couldn’t change how the older methods work as that would break websites. In the world of DOM/JS you can’t really make breaking changes.

https://humanwhocodes.com/blog/2010/09/28/why-is-getelements... Has more context

Re:GetElementById vs. QuerySelector by Ozzie_osman on Thursday November 25, 2021 @11:07PM (#29347399)
I'd actually expect the opposite just from the names. I'd expect a selector to select a "live" node, and getElement to get a static one.