|
| 1 | +<pre class='metadata'> |
| 2 | +Title: CSS Scoping Module Level 2 |
| 3 | +Level: 2 |
| 4 | +Shortname: css-scoping |
| 5 | +Group: CSSWG |
| 6 | +Status: ED |
| 7 | +Work Status: Exploring |
| 8 | +TR: https://www.w3.org/TR/css-scoping-1/ |
| 9 | +ED: https://drafts.csswg.org/css-scoping/ |
| 10 | +Editor: Tab Atkins Jr., Google, http://xanthir.com/contact/, w3cid 42199 |
| 11 | +Editor: Miriam E. Suzanne, Invited Expert, http://miriamsuzanne.com/contact, w3cid 117151 |
| 12 | +Abstract: This specification defines scoping/encapsulation mechanisms for CSS. |
| 13 | +Ignored Terms: inherit, slot, custom elements, stylesheets |
| 14 | +Ignored Vars: root elements |
| 15 | +</pre> |
| 16 | + |
| 17 | +<pre class="link-defaults"> |
| 18 | +spec:dom; type:dfn; |
| 19 | + text:host |
| 20 | + text:shadow root; for:/ |
| 21 | + text:root; for:tree |
| 22 | + text:find slottables |
| 23 | + text:find flattened slottables |
| 24 | + text:element; for:/ |
| 25 | +spec:html; type:element; text:style |
| 26 | +spec:selectors-4; type:dfn; |
| 27 | + text: static profile |
| 28 | + text: dynamic profile |
| 29 | +spec:css-pseudo-4; type:selector; |
| 30 | + text:::before |
| 31 | + text:::after |
| 32 | +spec:cascade-4; type:dfn; text: inherit |
| 33 | +</pre> |
| 34 | + |
| 35 | +<h2 id="intro"> |
| 36 | +Introduction</h2> |
| 37 | + |
| 38 | + Issue: This is a diff spec over <a href="https://www.w3.org/TR/css-scoping-1/">CSS Scoping Module Level 1</a>. |
| 39 | + It is currently an Exploratory Working Draft: |
| 40 | + if you are implementing anything, please use Level 1 as a reference. |
| 41 | + We will merge the Level 1 text into this draft once it reaches CR. |
| 42 | + |
| 43 | + |
| 44 | +<!-- |
| 45 | +████████ ████████ ████████ ███ ██ ██ ██ ████████ |
| 46 | +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
| 47 | +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
| 48 | +██ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ |
| 49 | +██ ██ ██ ██ █████████ ██ ██ ██ ██ |
| 50 | +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
| 51 | +████████ ████████ ██ ██ ██ ███████ ████████ ██ |
| 52 | +--> |
| 53 | + |
| 54 | +<h2 id='default-element-styles'> |
| 55 | +Default Styles for Custom Elements</h2> |
| 56 | + |
| 57 | + Issue: [[css-scoping-1#default-element-styles]] |
| 58 | + |
| 59 | +<!-- |
| 60 | + ██████ ██ ██ ███ ████████ ███████ ██ ██ |
| 61 | +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
| 62 | +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
| 63 | + ██████ █████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
| 64 | + ██ ██ ██ █████████ ██ ██ ██ ██ ██ ██ ██ |
| 65 | +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
| 66 | + ██████ ██ ██ ██ ██ ████████ ███████ ███ ███ |
| 67 | +--> |
| 68 | + |
| 69 | +<h2 id='shadow-dom'> |
| 70 | +Shadow Encapsulation</h2> |
| 71 | + |
| 72 | + Issue: [[css-scoping-1#shadow-dom]] |
| 73 | + |
| 74 | +<!-- |
| 75 | + ██████ ██████ ███████ ████████ ████ ██ ██ ██████ |
| 76 | +██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ |
| 77 | +██ ██ ██ ██ ██ ██ ██ ████ ██ ██ |
| 78 | + ██████ ██ ██ ██ ████████ ██ ██ ██ ██ ██ ████ |
| 79 | + ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ |
| 80 | +██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ |
| 81 | + ██████ ██████ ███████ ██ ████ ██ ██ ██████ |
| 82 | +--> |
| 83 | + |
| 84 | +<h2 id='scope'> |
| 85 | +Scoped Styles</h2> |
| 86 | + |
| 87 | + Issue: Introduce scoped styles |
| 88 | + |
| 89 | +<!-- |
| 90 | + ███████ ██████ ██████ ███████ ████████ ████████ |
| 91 | +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |
| 92 | +██ ███ ██ ██ ██ ██ ██ ██ ██ ██ |
| 93 | +██ ███ ██ ██████ ██ ██ ██ ████████ ██████ |
| 94 | +██ █████ ██ ██ ██ ██ ██ ██ |
| 95 | +██ ██ ██ ██ ██ ██ ██ ██ ██ |
| 96 | + ███████ ██████ ██████ ███████ ██ ████████ |
| 97 | +--> |
| 98 | + |
| 99 | +<h3 id='scope-atrule'> |
| 100 | +Scoping Styles in CSS: the ''@scope'' rule</h3> |
| 101 | + |
| 102 | + The <dfn>@scope</dfn> at-rule allows authors to create scoped style rules using CSS syntax. |
| 103 | + The syntax of the ''@scope'' rule is: |
| 104 | + |
| 105 | + <pre class='prod'> |
| 106 | + @scope (<<selector-list>>) [to (<<selector-list>>)]? { |
| 107 | + <<stylesheet>> |
| 108 | + } |
| 109 | + </pre> |
| 110 | + |
| 111 | + Issue: Define the ''@scope'' rule |
| 112 | + Issue: Define scope proximity in the cascade (cross-reference css-cascade) |
| 113 | + |
| 114 | +<h3 id='in-scope-selector'> |
| 115 | +Selecting inside a scope: the '':in-scope'' pseudo-class</h3> |
| 116 | + |
| 117 | + The <dfn>:in-scope</dfn> pseudo-class allows authors to |
| 118 | + select elements that are within a given scope. |
| 119 | + |
| 120 | + Issue: Define an '':in-scope'' selector (cross-reference css-selectors) |
| 121 | + |
| 122 | +<h2 id="changes"> |
| 123 | +Changes</h2> |
| 124 | + |
| 125 | +<h3 id="additions-l"> |
| 126 | +Additions Since Level 1</h3> |
| 127 | + |
| 128 | + The following features have been added since |
| 129 | + <a href="https://www.w3.org/TR/css-scoping-1/">Level 1</a>: |
| 130 | + |
| 131 | + * The ''@scope'' rule |
| 132 | + * The '':in-scope()'' pseudo-class |
| 133 | + |
| 134 | +Privacy and Security Considerations {#priv-sec} |
| 135 | +=============================================== |
| 136 | + |
| 137 | +This specification introduces Shadow DOM and some shadow-piercing capabilities, |
| 138 | +but this does not introduce any privacy or security issues-- |
| 139 | +shadow DOM, as currently specified, is intentionally not a privacy/security boundary |
| 140 | +(and the parts of the UA that use shadow DOM and <em>do</em> have a privacy/security boundary |
| 141 | +implicitly rely on protections not yet specified, |
| 142 | +which protect them from the things defined in this specification). |
| 143 | + |
0 commit comments