Skip to content

Commit

Permalink
Add ParentNode.replaceChildren() (#3176)
Browse files Browse the repository at this point in the history
Fixes #3102.
  • Loading branch information
ninevra committed Apr 15, 2021
1 parent e4c4004 commit 04f6c13
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/jsdom/living/nodes/ParentNode-impl.js
Expand Up @@ -55,6 +55,12 @@ class ParentNodeImpl {
this._append(convertNodesIntoNode(this._ownerDocument, nodes));
}

replaceChildren(...nodes) {
const node = convertNodesIntoNode(this._ownerDocument, nodes);
this._preInsertValidity(node, null);
this._replaceAll(node);
}

querySelector(selectors) {
if (shouldAlwaysSelectNothing(this)) {
return null;
Expand Down
1 change: 1 addition & 0 deletions lib/jsdom/living/nodes/ParentNode.webidl
Expand Up @@ -7,6 +7,7 @@ interface mixin ParentNode {

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

Element? querySelector(DOMString selectors);
[NewObject] NodeList querySelectorAll(DOMString selectors);
Expand Down
1 change: 0 additions & 1 deletion test/web-platform-tests/to-run.yaml
Expand Up @@ -222,7 +222,6 @@ Node-cloneNode.html: [timeout, Often takes more than 70 seconds to pass, https:/
Node-isConnected.html: [fail, Last two tests with <iframe> are failing]
ParentNode-querySelector-All-xht.xht: [fail, ::slotted() pseudo-class is not supported]
ParentNode-querySelector-All.html: [fail, ::slotted() pseudo-class is not supported]
ParentNode-replaceChildren.html: [fail, Not implemented]
ProcessingInstruction-escapes-1.xhtml: [fail, Unknown]
adoption.window.html: [fail, "We do not implement https://github.com/whatwg/dom/pull/754 due to https://github.com/whatwg/dom/issues/813"]
aria-attribute-reflection.tentative.html: [fail, Unknown]
Expand Down

0 comments on commit 04f6c13

Please sign in to comment.