@@ -184,6 +184,21 @@ Note: It's okay to give a part multiple names.
184
184
The "part name" should be considered similar to a class,
185
185
not an id or tagname.
186
186
187
+ <pre class="example">
188
+ <style>
189
+ c-e<b> ::part(textspan)</b> { color: red; }
190
+ </style>
191
+
192
+ <template id="c-e-template">
193
+ <span <b> part="textspan"</b> >This text will be red</span>
194
+ </template>
195
+ <c-e></c-e>
196
+ <script>
197
+ // Add template as custom elment c-e
198
+ ...
199
+ </script>
200
+ </pre>
201
+
187
202
Forwarding a Shadow Element: the <{html-global/partmap}> attribute {#partmap-attr}
188
203
----------------------------------------------------------------------------------
189
204
Any element in a shadow tree can have a <dfn element-attr for=html-global>partmap</dfn> attribute.
@@ -214,6 +229,35 @@ Issue: Decide whether we use "outer => inner" or vice-versa.
214
229
Issue: Decide whether to allow "ident1 => ident2 ident3 ..."
215
230
as shorthand for "ident1 => ident2, ident1 => ident3, ...".
216
231
232
+ <pre class="example">
233
+ <style>
234
+ c-e<b> ::part(textspan)</b> { color: red; }
235
+ </style>
236
+
237
+ <template id="c-e-outer-template">
238
+ <c-e-inner <b> partmap="innerspan textspan"</b> ></c-e-inner>
239
+ </template>
240
+
241
+ <template id="c-e-inner-template">
242
+ <span <b> part="innerspan"</b> >
243
+ This text will be red because the containing shadow
244
+ host forwards <b> innerspan</b> to the document as "textspan"
245
+ and the document style matches it.
246
+ </span>
247
+ <span <b> part="textspan"</b> >
248
+ This text will not be red because <b> textspan</b> in the document style
249
+ cannot match against the part inside the inner custom element
250
+ if it is not forwarded.
251
+ </span>
252
+ </template>
253
+
254
+ <c-e></c-e>
255
+ <script>
256
+ // Add template as custom elments c-e-inner, c-e-outer
257
+ ...
258
+ </script>
259
+ </pre>
260
+
217
261
Exposing More Widely: the <{html-global/theme}> attribute {#theme-attr}
218
262
-----------------------------------------------------------------------
219
263
0 commit comments