Skip to content

[css-cascade] may need to define cascading order between sibling encapsulation contexts #10889

Open
@dbaron

Description

@dbaron

The cascading spec defines cascading by encapsulation context as:

When comparing two declarations that are sourced from different encapsulation contexts, then for normal rules the declaration from the outer context wins, and for important rules the declaration from the inner context wins. For this purpose, [DOM] tree contexts are considered to be nested in shadow-including tree order.

This doesn't say what happens when comparing declarations from encapsulation contexts that are not directly inside or outside of each other.

I don't think this is relevant in CSS today. However if either of the following happens:

then I think we need to define the cascading order between sibling encapsulation context. For example, if you have an element A (with a shadow DOM that exposes a part P) that is itself slotted into the shadow DOM of a different element B, then this would be needed to define how a regular style styling the P element inside the A shadow DOM cascades with a ::slotted()::part() style inside of the B shadow DOM that styles the same element.

Maybe the reference to shadow-including-tree-order is intended to define this, but if it is it probably needs language more specific than "inside" and "outside".

(It might be both extra implementation complexity and possibly also a source of author confusion if the rules from sibling encapsulation contexts mix with each other as thought they're at the same "context" level.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Friday afternoon

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions