Skip to content

Commit b626a63

Browse files
cyrilletuziannevk
authored andcommitted
Add <slot>.assignedElements()
Equivalent to assignedNodes(), limited to returning element nodes. Tests: web-platform-tests/wpt#8636. Fixes WICG/webcomponents#602.
1 parent e3c8d23 commit b626a63

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

source

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59014,6 +59014,7 @@ interface <dfn>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {
5901459014
interface <dfn>HTMLSlotElement</dfn> : <span>HTMLElement</span> {
5901559015
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-slot-name">name</span>;
5901659016
sequence&lt;Node> <span data-x="dom-slot-assignedNodes">assignedNodes</span>(optional <span>AssignedNodesOptions</span> options);
59017+
sequence&lt;Element> <span data-x="dom-slot-assignedElements">assignedElements</span>(optional <span>AssignedNodesOptions</span> options);
5901759018
};
5901859019

5901959020
dictionary <dfn>AssignedNodesOptions</dfn> {
@@ -59052,6 +59053,13 @@ dictionary <dfn>AssignedNodesOptions</dfn> {
5905259053
<dd>Returns <var>slot</var>'s <span>assigned nodes</span>, if any, and <var>slot</var>'s children
5905359054
otherwise, and does the same for any <code>slot</code> elements encountered therein, recursively,
5905459055
until there are no <code>slot</code> elements left.</dd>
59056+
59057+
<dt><var>slot</var> . <code subdfn data-x="dom-slot-assignedElements">assignedElements</code>()</dt>
59058+
<dd>Returns <var>slot</var>'s <span>assigned nodes</span>, limited to elements.</dd>
59059+
59060+
<dt><var>slot</var> . <code data-x="dom-slot-assignedElements">assignedElements</code>({ flatten: true })</dt>
59061+
<dd>Returns the same as <code data-x="dom-slot-assignedNodes">assignedNodes({ flatten: true
59062+
})</code>, limited to elements.</dd>
5905559063
</dl>
5905659064

5905759065
<p>The <dfn data-x="dom-slot-name"><code>name</code></dfn> IDL attribute must <span>reflect</span>
@@ -59067,6 +59075,18 @@ dictionary <dfn>AssignedNodesOptions</dfn> {
5906759075
<li><p>Return the result of <span>finding flattened slotables</span> with this element.</p></li>
5906859076
</ol>
5906959077

59078+
<p>The <dfn data-x="dom-slot-assignedElements"><code>assignedElements(<var>options</var>)</code></dfn>
59079+
method, when invoked, must run these steps:</p>
59080+
59081+
<ol>
59082+
<li><p>If the value of <var>options</var>'s <code data-x="">flatten</code> member is false, then
59083+
return this element's <span>assigned nodes</span>, filtered to contain only <code>Element</code>
59084+
nodes.</p></li>
59085+
59086+
<li><p>Return the result of <span>finding flattened slotables</span> with this element, filtered
59087+
to contain only <code>Element</code> nodes.</p></li>
59088+
</ol>
59089+
5907059090

5907159091

5907259092
<h4 split-filename="canvas">The <dfn id="canvas"><code>canvas</code></dfn> element</h4>
@@ -120846,6 +120866,7 @@ INSERT INTERFACES HERE
120846120866
Csaba Gabor,
120847120867
Csaba Marton,
120848120868
Cynthia Shelly,
120869+
Cyrille Tuzi,
120849120870
Daksh Shah,
120850120871
Dan Callahan,
120851120872
Dan Ehrenberg,
@@ -121509,6 +121530,7 @@ INSERT INTERFACES HERE
121509121530
Tim Altman,
121510121531
Tim Johansson,
121511121532
Tim Perry,
121533+
Tim van der Lippe,
121512121534
TJ VanToll,
121513121535
Tobias Schneider,
121514121536
Tobie Langel,

0 commit comments

Comments
 (0)