mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Added Document.importNode content tests
This commit is contained in:
parent
2ca3d9b138
commit
10433648d3
1 changed files with 36 additions and 0 deletions
36
src/test/content/test_document_importNode.html
Normal file
36
src/test/content/test_document_importNode.html
Normal file
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue