[selectors-api] First element example

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 UTC