Re: [selectors-api] Scoped Selectors

Boris Zbarsky wrote:
> On 9/26/09 4:36 PM, Lachlan Hunt wrote:
>> A scoped selector string is a string that begins with an exclamation
>> point followed by a the remainder of the selector.
>
> This assumes that '!' will never be allowed at the beginning of a CSS
> selector, right?

It does, but the workaround would be to insert an extra space at the 
beginning.

I'd be willing to pick an alternative character to avoid any possible 
clash.  Perhaps a comma instead, like ",div div", which can never be 
used at the beginning of a conforming group of selectors.

I'm also considering adjusting the idea it so that it will work when the 
string simply begins with any combinator ('+', '~', or '>'), but we 
still need something to use in place of the descendant combinator as the 
space won't have the desired effect.

> Have you run this by the CSS working group?

Not yet, but will do so after I find out from this group if the 
technique is viable.

>> e.g. The selector ">em, >strong" supported by JS libraries can simply be
>> prefixed with a "!", like "!>em, >strong" and the implementation will be
>> able to process it to become ":scope>em, :scope>strong". Of course, it
>> will also work with the other combinators.
>
> That processing still needs to be defined, right?

Yes.  It would be useful to get feedback from implementers about how I 
should define this.

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/

Received on Sunday, 27 September 2009 07:15:22 UTC