v142 · css
Non-Tree-Scoped container-name Matching
Ignore tree-scope when matching container-name for @container queries.
concepts
-
Container name cross-shadow
Drag the slider to resize the outer container — a shadow-rooted custom element's
@container dashboardrule flips layout. Chrome 142+ resolves the name across the shadow boundary; older browsers ignore it. -
Component Library Across Shadow Trees
The pre-Chrome-142 footgun design-system authors flagged: a vendored
<vendor-card>with its own shadow root and@container sidebar / main-panerules now sees the host's container names — same component drops in anywhere without re-naming. -
Scope Conflict Resolver
Walk through four name combinations on a host-and-shadow tree — match, no match (rule side), no match (host side), and the new collision case where both define the same name. See exactly how the Chrome 142 resolution rule changed.
-
Shadow DOM Container Playground
Build a live custom element with its own shadow root, assign
container-nameon both the host and shadow internals, then write@containerrules and watch which elements respond. A toggle switches between pre-Chrome-142 (tree-scoped) and Chrome 142 (non-tree-scoped) matching to show the resolution difference.
why it shipped
Aligning with the spec change and Firefox implementation.