Matching :root in Document Fragments

Hi,
   In relation to the Selectors API specification, a question has come 
up about whether or not the :root pseudo-class would match anything in a 
document fragment that isn't part of a document [1].

For example, given the following fragment created by a script:

var html = document.createElement("html");
...
// create and append body and p elements to get the following tree
// but don't append the fragment to a Document node.

   html
   |
   +-body
     |
     +-p

The question is, would :root match the html element in that fragment, 
and thus what would the following return:

   var result = body.get(":root p");

The get() function returns descendants of the element (body in this 
case) that match the selector [2].

Selectors defines :root as:

| The :root pseudo-class represents an element that is the root of the
| document.

My assumption is that since the fragment isn't part of a document, there 
is no element that matches the :root pseudo-class, and so null would be 
returned in that example.  However, others have argued that it's unclear 
and that :root could match the html element in that example, and thus 
would return the p element.  Could the CSSWG please clarify this issue?

Thank you.

[1] http://lists.w3.org/Archives/Member/member-webapi/2007Jun/0019.html 
(member only, sorry)
[2] 
http://dev.w3.org/cvsweb/~checkout~/2006/webapi/selectors-api/Overview.src.html?content-type=text/html;%20charset=utf-8#documentselector
[3] http://www.w3.org/TR/css3-selectors/#root-pseudo

-- 
Lachlan Hunt
http://lachy.id.au/

Received on Thursday, 21 June 2007 14:31:17 UTC