W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: Opera's Proposal for :context Selector

From: Bert Bos <bert@w3.org>
Date: Wed, 16 Jul 2008 14:52:50 +0200
Cc: www-style <www-style@w3.org>
To: Undisclosed.Recipients: ;
Message-Id: <200807161452.50697.bert@w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:10 GMT