[whatwg] Selectors within <style scoped>

On Tue, Jul 19, 2011 at 6:11 AM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
> On 7/19/11 12:30 AM, Roland Steiner wrote:
>>
>> I think one could argue for either case. Personally, I think it's
>> advantageous to include the scoping element (i.e., use ":scope foo .bar,
>> foo:scope .bar"), in order to be able to do style the scoping element
>> itself rather than its children individually, e.g.
>>
>> :scope { background-color: mauve; }
>
> Hmm. ?I agree this is a useful thing to do, but perhaps it's better
> accomplished by not prepending ":scope " to selectors which have a :scope in
> the first sequence of simple selectors in addition to ones that have :root
> there?
>
> This would still not make "foo .bar" match if the scope is a foo, but would
> we actually want to match?

I think it's best for that case to *not* match.  Otherwise, you have
to explicitly remember to add a :not(:scope) to every rule that might
match the scoping element.

It's very easy to style the scoping element by using :scope explicitly.

~TJ

Received on Tuesday, 19 July 2011 08:47:47 UTC