Re: Opera's Proposal for :context Selector

On Saturday 12 July 2008 23:05, Lachlan Hunt wrote:
> Bjoern Hoehrmann wrote:
> > Could you explain why those other specifications are a concern at
> > all, and you can't just say the :context pseudo-class matches an
> > element if and only if some other specification identifies it as
> > the context ele- ment in a given selector evaluation context?
>
> Only because I didn't think of doing it in that way.

Björn's definition makes sense, but it is much too abstract to be 
useful. I can understand ':focus' and '::selection', because I have 
indeed given elements the focus and selected text in a document. 
But ':context' matches all elements (never parts of elements?) that are 
somehow "special" as defined by the source document. HTML doesn't 
define any such elements, nor does XML, so what does?

If there are concrete elements that are useful to select (first element 
on the page, previous element with the focus, longest element without 
children, element with the fewest vowels, whatever), than invent a name 
that describes those element.

> I have written 
> a revised version based on your suggestions.  It will now require
> both Selectors API and HTML5 to eventually define which element is
> the context element, which won't be difficult if this proposal is
> accepted.
>
> http://lists.w3.org/Archives/Public/www-archive/2008Jul/att-0023/Over
>view.html

It seems you want something like the \G in Perl's regular expressions. 
Why don't you define it in the Selectors API as a special notation 
accepted by the querySelector() function?

(It seems to me you shouldn't need it at all. The problem seems to be 
that x.querySelector(":root") doesn't return x. That looks strange to 
me: you pass a tree and a pattern, and you get something outside the 
tree!? But I'm not an expert on that spec...)



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France

Received on Wednesday, 16 July 2008 12:53:28 UTC