4 ms·
It would blow your mind if you saw how much slower querySelector is compared to old school getElementByid, getElementsByClassName etc. We tend to think that ne
by pantelisk 6y ago
It would blow your mind if you saw how much slower querySelector is compared to old school getElementByid, getElementsByClassName etc.
We tend to think that newer is better and faster, but it's also wise to think that old apis had to be fast on old hardware. Hardware that is not the target of new APIs.
- minitech 6y ago> how much slower querySelector is compared to old school getElementByid, getElementsByClassName IE 8 got querySelector before IE 9 got getElementsByClassName, so it’s not really an old vs. new thing, and I don’t think anyone expects querySelector to be faster than getElementById.
- brundolf 6y agoThat wouldn't blow my mind, and it's also a wildly different question. The OP is about a core language feature performing differently on two browsers. querySelector is fundamentally a higher-level API across all browsers. Also, block-scoping is a language feature that's fundamental to virtually every other modern language out there. This isn't some high-falutin' new API. This is basic.