- From: Boris Zbarsky <bzbarsky@mit.edu>
- Date: Tue, 28 Apr 2015 10:58:25 -0400
- To: Glen Huang <curvedmark@gmail.com>
- CC: public-webapps <public-webapps@w3.org>
On 4/28/15 1:58 AM, Glen Huang wrote: > Just a quick follow up question to quench my curiosity: if I do "list[1]" and no one has ever asked the list for any element, Gecko will find the first two matching elements, and store them in the list, if I then immediately do "list[0]", the first element is returned without walking the DOM (assuming there are at least two matching elements)? Yes, exactly. >> querySelector("foo") and getElementsByTagName("foo")[0] can return different nodes > > Still a bit confused regarding this. If the premise is the selector only contains characters allowed in a tag name Then in that case I _think_ those are now equivalent, though I'd have to check it carefully. They didn't use to be back when getElementsByTagName was defined as matching on qualified name, not localname... -Boris
Received on Tuesday, 28 April 2015 14:58:58 UTC