W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: QSA, the problem with ":scope", and naming

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 19 Oct 2011 12:30:01 -0400
Message-ID: <4E9EFB09.6040902@mit.edu>
To: Yehuda Katz <wycats@gmail.com>
CC: Alex Russell <slightlyoff@google.com>, public-webapps@w3.org
On 10/19/11 11:17 AM, Boris Zbarsky wrote:
> 4) Mapping Sizzle("#id") with document a context to
> getElementById("id"). This isn't a valid optimization for querySelector
> because there can be multiple elements with the same id;

And just as a note, since someone asked me off-list how this can 
possibly be true...  Given this markup:

     <div id="x">
       <div id="y"></div>
       <div id="y"></div>
     </div>

calling

   jQuery.find("#y")

returns an array with one element in it while calling

   jQuery.find("#y", document.getElementById("x"))

returns an array with two elements.  I have no idea whether this is 
purposeful behavior or just a bug in Sizzle brought on by the 
optimization listed above.

-Boris
Received on Wednesday, 19 October 2011 16:30:44 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:48 GMT