Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto merge of #1932 : brunoabinader/servo/document-import-adopt-node,…
… r=Ms2ger Specs: http://dom.spec.whatwg.org/#dom-document-importnode http://dom.spec.whatwg.org/#dom-document-adoptnode
- Loading branch information
Showing
6 changed files
with
110 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="harness.js"></script> | ||
<script> | ||
let foo = document.getElementById("foo"); | ||
let doc = document.implementation.createHTMLDocument("title"); | ||
|
||
is(foo.ownerDocument, document); | ||
|
||
let adopted_foo = doc.adoptNode(foo); | ||
is(document.getElementById("foo"), null); | ||
|
||
is(foo, adopted_foo); | ||
is(foo.ownerDocument, doc); | ||
is(foo.parentNode, null); | ||
is(foo.childNodes.length, 1); | ||
|
||
finish(); | ||
</script> | ||
</head> | ||
<body> | ||
<div id="foo"><div id="bar"></div></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="harness.js"></script> | ||
<script> | ||
let doc = document.implementation.createHTMLDocument("title"); | ||
is_not(doc, null); | ||
|
||
let foo = document.getElementById("foo"); | ||
is(foo.ownerDocument, document); | ||
|
||
let imported_foo = doc.importNode(foo); // deep = false | ||
is(imported_foo.parentNode, null); | ||
is(imported_foo.ownerDocument, doc); | ||
is(imported_foo.childNodes.length, 0); | ||
|
||
imported_foo = doc.importNode(foo, true); | ||
is(imported_foo.parentNode, null); | ||
is(imported_foo.ownerDocument, doc); | ||
is(imported_foo.childNodes.length, 1); | ||
|
||
let bar = document.createElement("div"); | ||
bar.appendChild(document.createElement("div")); | ||
|
||
imported_bar = doc.importNode(bar, true); | ||
is(imported_bar.parentNode, null); | ||
is(imported_bar.ownerDocument, doc); | ||
is(imported_bar.childNodes.length, 1); | ||
|
||
finish(); | ||
</script> | ||
</head> | ||
<body> | ||
<div id="foo"><div id="bar"></div></div> | ||
</body> | ||
</html> |