Re: [css-scoping] Shadow Cascading

On Fri, Jun 12, 2015 at 9:05 AM, Hayato Ito <hayato@google.com> wrote:
>
>
> On Fri, Jun 12, 2015 at 3:47 PM Rune Lillesveen <rune@opera.com> wrote:
>>
>> Yes, the scopes established by NODE's own shadow roots must be
>> included for :host and :host-context.
>>
>> While the proposed scope linearization algorithm describes which
>> scopes may contain rules that apply to NODE, isn't it so that the
>> inner/outer scope order is simply the tree-of-trees order of the
>> scopes?
>>
>
> Yeah, they are always same (in terms of relative order)! I thought there is
> a case where they are different. However, I can't find a case where they are
> different. That's an unintentional outcome, however it sounds a good news to
> us.


PROPOSAL:

Replace this text in 3.3.1:

"When comparing two declarations, if one of them is in a shadow tree
and the other is in a document that contains that shadow tree, then
for normal rules the declaration from the outer document wins, and for
important rules the declaration from the shadow tree wins."

with:

"When comparing two declarations from different shadow trees, then for
normal rules the declaration from the tree which comes first in the
tree of trees order wins, and for important rules the declaration from
the tree which comes last in the tree-of-trees order wins. The tree of
trees order is defined by the Shadow DOM specification."


PROPOSAL:

Given the change above, order of appearance will never apply when
comparing declarations from different shadow trees, just order of
appearance within one tree. Hence, I think this sentence can be
removed, as it will just add confusion:

"When calculating Order of Appearance, the tree of trees, defined by
the Shadow DOM specification, is used to calculate ordering."


Multiple shadow roots:

The tree of trees ordering of multiple shadow roots is now gone from
the Shadow DOM spec draft, but if I look at the latest published WD,
the tree of trees ordering says the oldest shadow root comes first,
which is the opposite of what is the case when constructing the event
path or the composed tree, so I think that looks inconsistent. I
haven't studied the Shadow DOM spec in enough detail to say if
ordering shadow roots the other way around for tree of trees ordering
would actually make a difference for the rest of that spec, but if the
tree of trees ordering was the other way around for multiple shadow
roots, the first PROPOSAL above would also cover the multiple shadow
roots case.

Now, since multiple shadow roots are already gone from the Shadow DOM
draft for v1, the sentence where we describe cascade order for such
trees can be removed regardlessly.

PROPOSAL:

Drop the following text:

"When comparing two declarations, if both are in shadow trees with the
same host element, then for normal rules the declaration from the
shadow tree that was created most recently wins, and for important
rules the declaration from the shadow tree that was created less
recently wins."


CLARIFICATION:

I don't know if this is obvious, as there are special casing for
declarations from the style attributes in connection with scoped
stylesheets in [1], but I think declarations from style attributes
should belong to the same tree in terms of cascading as the element on
which it is set. That means, whether an element inside a shadow tree
is styled through a stylesheet rule in the shadow tree, or a style
attribute on that element should not affect the cascade order of that
declaration and a declaration from the outer tree.

Should this be made explicit in the spec, or does that follow directly
from the fact that the attribute, hence the declaration, lives in the
same tree as the element on which it is set?

[1] http://dev.w3.org/csswg/css-cascade-3/#cascade-scope

-- 
Rune Lillesveen

Received on Wednesday, 24 June 2015 10:34:55 UTC