Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyGu committed Jan 3, 2020
1 parent 3151625 commit 9e2dc90
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 0 additions & 2 deletions lib/jsdom/living/nodes/Document-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,6 @@ class DocumentImpl extends NodeImpl {
"Cannot adopt a shadow root",
"HierarchyRequestError"
]);
} else if (DocumentFragment.isImpl(node) && node._host) {
return node;
}

this._adoptNode(node);
Expand Down
10 changes: 8 additions & 2 deletions lib/jsdom/living/nodes/Node-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,8 @@ class NodeImpl extends EventTargetImpl {
referenceChildImpl = domSymbolTree.nextSibling(nodeImpl);
}

this._ownerDocument._adoptNode(nodeImpl);

this._insert(nodeImpl, referenceChildImpl);

return nodeImpl;
Expand Down Expand Up @@ -752,8 +754,6 @@ class NodeImpl extends EventTargetImpl {
domSymbolTree.lastChild(this);

for (const node of nodesImpl) {
this._ownerDocument._adoptNode(node);

if (!childImpl) {
domSymbolTree.appendChild(this, node);
} else {
Expand Down Expand Up @@ -940,6 +940,8 @@ class NodeImpl extends EventTargetImpl {

const previousSiblingImpl = domSymbolTree.previousSibling(childImpl);

this._ownerDocument._adoptNode(nodeImpl);

let removedNodesImpl = [];

if (domSymbolTree.parent(childImpl)) {
Expand All @@ -960,6 +962,10 @@ class NodeImpl extends EventTargetImpl {

// https://dom.spec.whatwg.org/#concept-node-replace-all
_replaceAll(nodeImpl) {
if (nodeImpl !== null) {
this._ownerDocument._adoptNode(nodeImpl);
}

const removedNodesImpl = domSymbolTree.childrenToArray(this);

let addedNodesImpl;
Expand Down
4 changes: 3 additions & 1 deletion test/web-platform-tests/to-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ Element-closest.html: [fail, :has is not supported (by all major browsers as wel
Element-firstElementChild-entity-xhtml.xhtml: [fail, Unknown]
Element-firstElementChild-entity.svg: [fail, Unknown]
Element-getElementsByTagName-change-document-HTMLNess.html: [fail, Unknown]
MutationObserver-childList.html: [fail, 'Spec or test bug: https://github.com/whatwg/dom/issues/814']
MutationObserver-document.html: [fail, Usage of external scripts doesn't block HTML parsing, https://github.com/jsdom/jsdom/issues/2413]
MutationObserver-sanity.html: [fail, TypeError is not instanceof TypeError]
Node-childNodes.html: [fail, Unknown]
Expand All @@ -161,6 +160,7 @@ ParentNode-querySelector-All-xht.xht: [fail, ::slotted() pseudo-class is not sup
ParentNode-querySelector-All.html: [fail, ::slotted() pseudo-class is not supported]
ProcessingInstruction-escapes-1.xhtml: [fail, Unknown]
Text-constructor.html: [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]
aria-element-reflection.tentative.html: [fail, WAI-ARIA not implemented]
remove-and-adopt-thcrash.html: [fail, window.open not implemented]
Expand Down Expand Up @@ -822,6 +822,8 @@ script-type-and-language-js.html: [fail, Our script execution timing is off; see

DIR: html/semantics/scripting-1/the-template-element

template-element/template-content-hierarcy.html: [fail, "We do not implement https://github.com/whatwg/dom/pull/754 due to https://github.com/whatwg/dom/issues/813"]

---

DIR: html/semantics/selectors
Expand Down

0 comments on commit 9e2dc90

Please sign in to comment.