8000 lots of changes · w3c/csswg-drafts@35f1db8 · GitHub
Skip to content

Commit 35f1db8

Browse files
committed
lots of changes
1 parent bbc1d3f commit 35f1db8

1 file changed

Lines changed: 30 additions & 29 deletions

File tree

css-shadow-parts-1/Overview.bs

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -129,41 +129,45 @@ which is an <a>ordered map</a>,
129129
with keys that are tokens
130130
and values that are [=ordered sets=] of tokens.
131131

132-
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>
133133
with keys that are [=strings=]
134134
and values that are [=ordered sets=] of elements.
135135

136-
The shadow part element map is described
136+
The part element map is described
137137
only as part of the algorithm for calculating style in this spec.
138138
It is not exposed via the DOM,
139139
as calculating it may be expensive
140140
and exposing it could allow access to elements inside closed shadow roots.
141141

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
143143
and changes to the part name lists and part name maps of elements in the DOM.
144144

145-
To calculate the shadow part element map of a shadow root
145+
To calculate the part element map of a shadow root, |r|:
146146

147147
<ol>
148-
<li>For each element within this "outer" shadow root
148+
<li>For each element, |el| within |r|
149149
<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:
153154
<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|
159161
</ol>
160162
</ol>
161163
</ol>
162164

8000
163165

164166
Issue: Include wild-card forwarding in algortihm.
165167

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?
167171

168172
Naming a Shadow Element: the <{html-global/part}> attribute {#part-attr}
169173
------------------------------------------------------------------------
@@ -181,35 +185,32 @@ Forwarding a Shadow Element: the <{html-global/partmap}> attribute {#partmap-att
181185
----------------------------------------------------------------------------------
182186
Any element in a shadow tree can have a <dfn element-attr for=html-global>partmap</dfn> attribute.
183187
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>
185190
(as if they were elements in the same tree as the host,
186-
name by a part attribute).
191+
named by a part attribute).
187192

188193
The partmap attribute is parsed as a comma-separated list of part mappings.
189194
Each part mapping is one of:
190195

191196
<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
196199

197200
: <code>ident</code>
198201
:: Is equivalent to <code>ident => ident</code>.
199202

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-
205203
: anything else
206204
:: Ignored for error-recovery / future compat.
207205
</dl>
208206

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-
211207
Note: It's okay to map a sub-part to several names.
212208

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+
213214
Exposing More Widely: the <{html-global/theme}> attribute {#theme-attr}
214215
-----------------------------------------------------------------------
215216

@@ -246,7 +247,7 @@ The syntaxes of them are:
246247

247248
The ''::part()'' pseudo-element only matches anything
248249
when the <a>originating element</a> is a <a>shadow host</a>.
249-
If the <a>originating element's</a> <a>shadow root's</a> <a>shadow part element map</a>
250+
If the <a>originating element's</a> <a>shadow root's</a> <a>part element map</a>
250251
[=map/contains=] the specified <<ident>>,
251252
''::part()'' matches the element or elements keyed to that <<ident>>.
252253
Otherwise, it matches nothing.
@@ -297,7 +298,7 @@ but never match additional <a>shadow-part pseudo-elements</a>.
297298

298299
If the <code>&lt;x-panel></code>'s internal confirm button had used something like
299300
<code>part="confirm-button, * => confirm-*"</code>
300-
to forward the button's internal parts up into the panel's own <a>shadow part element map</a>,
301+
to forward the button's internal parts up into the panel's own <a>part element map</a>,
301302
then a selector like
302303
''x-panel::part(confirm-label)''
303304
would select just the one button's label,

0 commit comments

Comments
 (0)