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

[selectors-api] First element example

From: Gavin Kistner <gavin@phrogz.net>
Date: Tue, 18 Nov 2008 21:11:48 -0700
Message-Id: <30670BA4-7DA3-427C-A3C9-D5E50FEBB3BF@phrogz.net>
To: public-webapps@w3.org

The second example in section 8 uses the following code:
   var x = document.querySelector("#foo, #bar");

It goes on to rather explicitly state, "In the sample document above,  
it would select the div element with the ID of foo because it is first  
***in document order***" (my emphasis).

Nonetheless, I believe the example code could help clarify the  
situation further by being changed to:
   var x = document.querySelector("#bar, #foo");

This, along with the assertion that div#foo is the value of x, would  
ensure that the casual reader might not mistakenly believe that the  
order of selectors in a group affects the ordering of the results.
Received on Wednesday, 19 November 2008 04:12:28 GMT

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