Skip to content

[css-cascade-4] Could you clarify if a web page’s DOM tree itself is an encapsulation context? #5501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
simevidas opened this issue Sep 5, 2020 · 4 comments
Labels
css-cascade-4 Current Work

Comments

@simevidas
Copy link
Contributor

simevidas commented Sep 5, 2020

Regarding the new Context criterion

A document language can provide for blending declarations sourced from different encapsulation contexts, such as the nested tree contexts of shadow trees in the [DOM].

https://drafts.csswg.org/css-cascade-4/#encapsulation-contexts

Is a web page’s own DOM tree also an encapsulation context?

For example, if a page has a custom element with a shadow DOM, are there two encapsulation contexts (the page’s own tree and the nested shadow tree), or is there only one encapsulation context (the nested shadow tree)?

@tabatkins tabatkins added the css-cascade-4 Current Work label Sep 6, 2020
@tabatkins
Copy link
Member

Is there any consequence to the decision either way?

(The use of "different" implies you start in one, tho.)

@simevidas
Copy link
Contributor Author

Ah, I remembered that style rules from the other page aren’t matched against elements in the shadow tree, and vice versa.

So when does this blending of declarations from different encapsulation contexts during the cascade happen in HTML in practice? Could you give an example?

@tabatkins
Copy link
Member

When the outer page uses a ::part() rule to target an element in a shadow, or a shadow uses a ::slotted() rule to target elements from the light.

@simevidas
Copy link
Contributor Author

Ah, I see 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-cascade-4 Current Work
Projects
None yet
Development

No branches or pull requests

2 participants