Skip to content

Commit

Permalink
Define ParentNode's replaceChildren()
Browse files Browse the repository at this point in the history
Tests: web-platform-tests/wpt#22524

Fixes #478. Closes #755 and closes #835.
  • Loading branch information
saschanaz authored Apr 20, 2020
1 parent 61834f7 commit 3a11492
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions dom.bs
Original file line number Diff line number Diff line change
@@ -2797,6 +2797,7 @@ interface mixin ParentNode {

[CEReactions, Unscopable] void prepend((Node or DOMString)... nodes);
[CEReactions, Unscopable] void append((Node or DOMString)... nodes);
[CEReactions, Unscopable] void replaceChildren((Node or DOMString)... nodes);

Element? querySelector(DOMString selectors);
[NewObject] NodeList querySelectorAll(DOMString selectors);
@@ -2836,6 +2837,15 @@ Element includes ParentNode;
the <a>node tree</a> are violated.
<!-- "NotFoundError" is impossible -->

<dt><code><var>node</var> . <a method for=ParentNode lt="replaceChildren()">replaceChildren</a>(<var>nodes</var>)</code>
<dd>
<p>Replace all <a>children</a> of <var>node</var> with <var>nodes</var>,
while replacing strings in <var>nodes</var> with equivalent {{Text}} <a for=/>nodes</a>.

<p><a>Throws</a> a "{{HierarchyRequestError!!exception}}" {{DOMException}} if the constraints of
the <a>node tree</a> are violated.
<!-- "NotFoundError" is impossible -->

<dt><code><var>node</var> . <a method for=ParentNode lt="querySelector()">querySelector</a>(<var>selectors</var>)</code>
<dd>
Returns the first <a for="/">element</a> that is a
@@ -2883,6 +2893,19 @@ must run these steps:
<li><p><a>Append</a> <var>node</var> to <a>this</a>.
</ol>

<p>The <dfn method for=ParentNode><code>replaceChildren(<var>nodes</var>)</code></dfn> method, when invoked,
must run these steps:

<ol>
<li><p>Let <var>node</var> be the result of <a>converting nodes into a node</a> given
<var>nodes</var> and <a>this</a>'s <a for=Node>node document</a>.

<li><p><a>Ensure pre-insertion validity</a> of <var>node</var> into <a>this</a> before
null.

<li><p><a for=Node>Replace all</a> with <var>node</var> within <a>this</a>.
</ol>

<p>The <dfn method for=ParentNode><code>querySelector(<var>selectors</var>)</code></dfn> method,
when invoked, must return the first result of running <a>scope-match a selectors string</a>
<var>selectors</var> against <a>this</a>, if the result is not an empty list, and null otherwise.
@@ -10071,6 +10094,7 @@ Joshua Bell,
J. S. Choi,
Jungkee Song,
Justin Summerlin,
Kagami Sascha Rosylight,
呂康豪 (Kang-Hao Lu),
田村健人 (Kent TAMURA),
Kevin Sweeney,

0 comments on commit 3a11492

Please sign in to comment.