3 ms·
What an awful design. Why would it differ like that? No doubt some legacy baggage that was later turned into a justification.
by sillysaurusx 5y ago
What an awful design. Why would it differ like that? No doubt some legacy baggage that was later turned into a justification.
- Ozzie_osman 5y agoI'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.
- jayflux 5y agoThese 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-getelementsbytagname-faster-that-queryselectorall/ https://humanwhocodes.com/blog/2010/09/28/why-is-getelements... Has more context