Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardHTMLhost and host-contextSingle-choice MCQ

`:host-context(.theme)` and `:host(.theme)` are both present in a shadow stylesheet. The shadow tree's host element ITSELF has class `theme`, and so does a flat-tree ancestor several levels up. Considering how `:host-context` walks the flat tree, which rule(s) match and is there a double-match concern?

/* shadow CSS */ :host(.theme) { --x: 1; } :host-context(.theme) { --x: 2; } /* host: <div class="theme"> ancestor: <body class="theme"> */