Skip to content

Commit

Permalink
Editorial: Specify ParentNode.replaceChildren implementation.
Browse files Browse the repository at this point in the history
  References:
    - whatwg#478
  • Loading branch information
snuggs committed Feb 14, 2020
1 parent b4e91f5 commit 948658b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2793,6 +2793,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);
Expand Down Expand Up @@ -2832,6 +2833,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><a for=Node>Replace all</a> <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
Expand Down Expand Up @@ -2879,6 +2889,16 @@ 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><a for=Node>Replace all</a> <a>children</a> of <a>this</a> with <var>node</var>.
</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.
Expand Down

0 comments on commit 948658b

Please sign in to comment.