- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Wed, 13 Jul 2011 13:25:28 +0200
- To: www-style <www-style@w3.org>
Hi,
I was just informed that :scope has now been added to the draft of
Selectors 4 [1]. I have some concerns regarding the new definition and
how it differs from that which I originally wrote in the Selectors API 2
draft [2]. Some important aspects of the original definition are no
longer present in the Selectors 4 definition.
The original definition included the concept of a "contextual reference
element" set with the intended purpose of allowing other specifications
to define the specific elements that belong to that set in a given
context. This is the way in which Selectors API itself defined the
elements that match, and it is the way in which HTML5 will (though it
currently doesn't) define it for scope="".
The new definition in Selectors 4 omits this feature and instead just
refers to the contextual reference element concept (actually incorrectly
referred to as "contextual reference node") as an example of how
Selectors API does it. This means that any specification that wants to
utilise :scope has to come up with their own way of defining it, rather
than simply defining which elements belong to the "contextual reference
element" set and referencing Selectors 4.
The new defintition also states:
"The :scope pseudo-class represents an element that defines scope for
the selector."
However, it's not clear what an "element that defines scope for the
selector" actually means, since the concept of defining scope is not
defined anywhere. Note that it doesn't necessarily mean the root of the
subtree within which the selectors are evaluated, since the elements
that match :scope can occur anywhere within the document, depending on
how and where the :scope selector is used.
Finally, there is also an open issue regarding "If the scope is not
defined by an element, then ???". The original definition already
clearly defined this by stating that :scope matched, in order of preference:
1. Defined contextual reference elements.
2. The documentElement of the ownerDocument, if there is one.
(effectively :root)
3. Otherwise, nothing.
So I would really prefer if Selectors 4 adopted the text of the original
definition I wrote in Selectors API, rather than starting from scratch,
since it has already received lots of review and refinements and deals
with issues not handled by the new definition.
[1] http://dev.w3.org/csswg/selectors4/#scope-pseudo
[2] http://dev.w3.org/2006/webapi/selectors-api2/#the-scope-pseudo-class
[3] http://dev.w3.org/2006/webapi/selectors-api2/#evaluate-a-selector
--
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/
Received on Wednesday, 13 July 2011 11:25:55 UTC