[whatwg] Selectors within <style scoped>

Tab Atkins Jr. jackalmage at gmail.com
Thu Jun 16 14:56:03 PDT 2011


On Thu, Jun 16, 2011 at 2:18 PM, David Hyatt <hyatt at apple.com> wrote:
> On Jun 16, 2011, at 4:14 PM, Tab Atkins Jr. wrote:
>> On Thu, Jun 16, 2011 at 1:48 PM, David Hyatt <hyatt at apple.com> wrote:
>>> Do you actually mean try out both ":scope" tacked on to the end of the rule as well as ":scope " (note the space indicating a descendant selector) tacked on to the beginning?
>>>
>>> So for example, #foo { } would turn into #foo:scope, :scope #foo { } thus allowing it to match either the scope or a descendant of the scope?
>>
>> No, it's an if/else.  "#foo" would be equivalent to ":scope #foo".  On
>> the other hand, "#foo :scope" would be unaltered.
>
> So you're suggesting it would be impossible for a rule to match the scope itself without the author having to explicitly qualify it with :scope? That seems very unintuitive.

Yes, though you'd just write the selector explicitly as ":scope".  I
believe it's a relatively minor issue compared to the larger
non-intuitiveness of @scoped being a filter rather than a scope.

I think it's pretty easy to learn that bare selectors only apply to
children of the scoping element, not the scoping element itself.

~TJ



More information about the whatwg mailing list