[whatwg] Selectors within <style scoped>

Roland Steiner rolandsteiner at google.com
Mon Jul 18 21:10:16 PDT 2011


On Tue, Jul 19, 2011 at 12:40 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote:

> On 7/18/11 10:55 PM, Dimitri Glazkov wrote:
>
>> I actually really like this proposal.
>>
>> Let's do this. Roland, Dave, Boris -- what do y'all think?
>>
>
> The proposal being that all selectors are scoped except the ones where
> :root is present in the first sequence of simple selectors (not quite what
> Kornel said, but I think that's what he meant)?
>
> That seems ok to me, I think.  David, thoughts?
>

Just to nail this down:

foo .bar
    scoped, foo must be the scope element or a descendant

:root foo .bar
    NOT scoped, foo can be matched outside the scope

html foo .bar
    scoped, will not match, unless <html> element itself somehow becomes the
scoping element (can this happen?)

body foo .bar
    scoped, will potentially match only if <style scoped> is a direct child
of <body> (thus <body> becoming the scoping element)

html:root foo .bar
    NOT scoped due to the presence of :root in the first sequence (even
though not absolutely the first simple selector)

Seems reasonable, except there may be the question why it "works" with
:root, but not with 'html' or 'body', but I guess that can be explained.


Cheers,

- Roland



More information about the whatwg mailing list