Remove mentions of :host-context
This commit is contained in:
parent
18a039473a
commit
ac96edec3f
1 changed files with 2 additions and 17 deletions
|
@ -111,22 +111,7 @@ customElements.define('custom-dialog', class extends HTMLElement {
|
|||
|
||||
Now the additional centering styles are only applied to the first dialog: `<custom-dialog centered>`.
|
||||
|
||||
## :host-context(selector)
|
||||
|
||||
Same as `:host`, but applied only if the shadow host or any of its ancestors in the outer document matches the `selector`.
|
||||
|
||||
E.g. `:host-context(.dark-theme)` matches only if there's `dark-theme` class on `<custom-dialog>` on anywhere above it:
|
||||
|
||||
```html
|
||||
<body class="dark-theme">
|
||||
<!--
|
||||
:host-context(.dark-theme) applies to custom-dialogs inside .dark-theme
|
||||
-->
|
||||
<custom-dialog>...</custom-dialog>
|
||||
</body>
|
||||
```
|
||||
|
||||
To summarize, we can use `:host`-family of selectors to style the main element of the component, depending on the context. These styles (unless `!important`) can be overridden by the document.
|
||||
To summarize, we can use `:host`-family of selectors to style the main element of the component. These styles (unless `!important`) can be overridden by the document.
|
||||
|
||||
## Styling slotted content
|
||||
|
||||
|
@ -317,7 +302,7 @@ Shadow DOM can include styles, such as `<style>` or `<link rel="stylesheet">`.
|
|||
|
||||
Local styles can affect:
|
||||
- shadow tree,
|
||||
- shadow host with `:host`-family pseudoclasses,
|
||||
- shadow host with `:host` and `:host()` pseudoclasses,
|
||||
- slotted elements (coming from light DOM), `::slotted(selector)` allows to select slotted elements themselves, but not their children.
|
||||
|
||||
Document styles can affect:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue