You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: css-shadow-parts-1/Overview.bs
+30-29Lines changed: 30 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -129,41 +129,45 @@ which is an <a>ordered map</a>,
129
129
with keys that are tokens
130
130
and values that are [=ordered sets=] of tokens.
131
131
132
8000
td>
-
Each <a>shadow root</a> can be thought of as having a <dfn export for="shadow root">shadow part element map</dfn>
132
+
Each <a>shadow root</a> can be thought of as having a <dfn export for="shadow root">part element map</dfn>
133
133
with keys that are [=strings=]
134
134
and values that are [=ordered sets=] of elements.
135
135
136
-
The shadow part element map is described
136
+
The part element map is described
137
137
only as part of the algorithm for calculating style in this spec.
138
138
It is not exposed via the DOM,
139
139
as calculating it may be expensive
140
140
and exposing it could allow access to elements inside closed shadow roots.
141
141
142
-
Shadow part element maps are affected by the addition and removal of elements
142
+
Part element maps are affected by the addition and removal of elements
143
143
and changes to the part name lists and part name maps of elements in the DOM.
144
144
145
-
To calculate the shadow part element map of a shadow root
145
+
To calculate the part element map of a shadow root, |r|:
146
146
147
147
<ol>
148
-
<li>For each elementwithin this "outer" shadow root
148
+
<li>For each element, |el| within |r|
149
149
<ol>
150
-
<li>For each name in the element's part name list,
151
-
add this element to outer-shadow-root-part-map[name]
152
-
<li>If the element is a shadow host:
150
+
<li>For each |name| in |el|'s part name list,
151
+
add |el| to |r|'s part element map
152
+
under the key |name|.
153
+
<li>If |el| is a shadow host itself, let |er| be its shadow root:
153
154
<ol>
154
-
<li>Calculate the shadow part element map of its shadow root ("inner" shadow root).
155
-
<li>For each key ("outer name") in the outershadow root part name map
156
-
and for each token ("inner name") in that key's ordered set of tokens
157
-
look up inner-shadow-root-part-map[inner name] to get a (possibly empty) set of elements
158
-
and add these elements to outer-shadow-poot-part-map[outer name].
155
+
<li>Calculate |er|'s part element map.
156
+
<li>For each key, |outerName|, in |r|'s part name map
157
+
and for each token |innerName| under that key
158
+
look up |innerName| in |er|'s shadow part element map
159
+
to get a (possibly empty) set of elements
160
+
and add these elements to |r|'s part element map under |outerName|
159
161
</ol>
160
162
</ol>
161
163
</ol>
162
164
8000
163
165
164
166
Issue: Include wild-card forwarding in algortihm.
165
167
166
-
Issue: There is no need for the shadow part element map values to be ordered, can we drop that?
168
+
Issue: When doing prefixed-wildcard forwarding, should probably automatically exclude sub-parts that are manually forwarded. With that, would be good to have a syntax to block forwarding of a sub-part (currently would require `foo => nonsense-name`).
169
+
170
+
Issue: There is no need for the part element map values to be ordered, can we drop that?
167
171
168
172
Naming a Shadow Element: the <{html-global/part}> attribute {#part-attr}
Any element in a shadow tree can have a <dfn element-attr for=html-global>partmap</dfn> attribute.
183
187
If the element is a shadow host,
184
-
this is used to expose parts from inside this host's <a>shadow tree</a> to outside this host's containing <a>shadow tree</a>
188
+
this is used to allow styling of parts from hosts inside the <a>shadow tree</a>
189
+
by rules outside this the <a>shadow tree</a>
185
190
(as if they were elements in the same tree as the host,
186
-
name by a part attribute).
191
+
named by a part attribute).
187
192
188
193
The partmap attribute is parsed as a comma-separated list of part mappings.
189
194
Each part mapping is one of:
190
195
191
196
<dl class=switch>
192
-
: <code>ident1 => ident2</code>
193
-
:: If el is a <a>shadow host</a>,
194
-
and it's <a>shadow root's</a><a>shadow part map</a> |partMap| [=map/contains=] ident1,
195
-
then this adds «[ ident2 → |partMap|[ident1] ]» to the <a>shadow part map</a> of the <a>shadow root</a> containing el.
197
+
: <code>outerIdent => innerIdent</code>
198
+
:: this adds «[ outerIdent → innerIdent ]» to el's <a>part name map</a>. This exposes
196
199
197
200
: <code>ident</code>
198
201
:: Is equivalent to <code>ident => ident</code>.
199
202
200
-
: <code>* => prefix*</code>
201
-
:: If el is a <a>shadow host</a>,
202
-
then [=map/for each=] |ident| → |subEl| in el's <a>shadow root's</a><a>shadow part map</a>,
203
-
«[ prefix + |ident| → |subEl| ]» is added to the <a>shadow part map</a> of the <a>shadow root</a> containing el.
204
-
205
203
: anything else
206
204
:: Ignored for error-recovery / future compat.
207
205
</dl>
208
206
209
-
Issue: When doing prefixed-wildcard forwarding, should probably automatically exclude sub-parts that are manually forwarded. With that, would be good to have a syntax to block forwarding of a sub-part (currently would require `foo => nonsense-name`).
210
-
211
207
Note: It's okay to map a sub-part to several names.
212
208
209
+
Issue: Decide whether we use "outer => inner" or vice-versa.
210
+
211
+
Issue: Decide whether to allow "ident1 => ident2 ident3 ..."
212
+
as shorthand for "ident1 => ident2, ident1 => ident3, ...".
213
+
213
214
Exposing More Widely: the <{html-global/theme}> attribute {#theme-attr}
0 commit comments