W3C home > Mailing lists > Public > www-style@w3.org > February 2015

Re: [css-scoping] Shadow Cascading

From: Rune Lillesveen <rune@opera.com>
Date: Thu, 5 Feb 2015 14:30:26 +0100
Message-ID: <CANz6XvT+j6nM1Z2_wEFuM6jdyka_hsou58JDiJFySCo8wEHxBg@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Hayato Ito <hayato@google.com>, www-style list <www-style@w3.org>
On Thu, Feb 5, 2015 at 12:33 AM, Rune Lillesveen <rune@opera.com> wrote:
> On Wed, Feb 4, 2015 at 11:52 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> On Thu, Feb 5, 2015 at 9:38 AM, Hayato Ito <hayato@google.com> wrote:
>>> Looks like the current spec wants to say:
>>>
>>> 1. The Origin and Importance matters
>>> 2. [Shadow Tree] The outer wins the inner (only when there is an
>>> ancestor/descendant relationship between two node trees)
>>> 3. [Shadow Tree] The younger wins the older (only when they are hosted by
>>> the same shadow host)
>>> 4. Specificity matters
>>> 5. Order of Appearance in tree-of-trees matters
>>
>> Yes.  As far as I can tell, that's *exactly* what the spec is saying.
>> Is there anything unclear?
>
> No, it's clear now.

I'm sorry, but I'm afraid it isn't. There seems to be a circularity
here. Consider:

<!DOCTYPE html>
<div id="outerHost">
    <div id="innerHost">
        <div id="t" class="t">Which color do I have?</div>
    </div>
</div>
<script>
var outerRoot = outerHost.createShadowRoot();
var innerRootOld = innerHost.createShadowRoot();
var innerRoot = innerHost.createShadowRoot();

outerRoot.innerHTML = "<style>::content #t { color: red
}</style><content></content>";
innerRootOld.innerHTML = "<style>::content #t.t { color: green
}</style><content></content>";
innerRoot.innerHTML = "<style>::content .t { color: blue
}</style><shadow></shadow>";
</script>

Given rules in outerRoot(1), innerRootOld(2), and innerRoot(3) respectively.

- None of the scopes has a parent-child relationship in the tree-of-trees.
- (2) beats (1) due to specificity
- (1) beats (3) due to specificity
- (3) beats (2) because it's younger

-- 
Rune Lillesveen
Received on Thursday, 5 February 2015 13:30:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:01 UTC