Why is getElementsByTagName() faster than querySelectorAll()?
Why is getElementsByTagName() faster than querySelectorAll()?
Should come as no surprise if you know that getElementsByTagName
returns a live NodeList, which means its grabbing a cached item from the DOM without doing much work collecting nodes.
You pay the cost later if you do much looping on that live list.