OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>Document.adoptNode</title> | 3 <title>Document.adoptNode</title> |
4 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-adoptnode"> | 4 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-adoptnode"> |
5 <script src="/resources/testharness.js"></script> | 5 <script src="/resources/testharness.js"></script> |
6 <script src="/resources/testharnessreport.js"></script> | 6 <script src="/resources/testharnessreport.js"></script> |
7 <div id="log"></div> | 7 <div id="log"></div> |
8 <!-- creates an element with local name "x<": --><x<>x</x<> | 8 <!--creates an element with local name "x<": --><x<>x</x<> |
9 <script> | 9 <script> |
10 test(function() { | 10 test(function() { |
11 var y = document.getElementsByTagName("x<")[0] | 11 var y = document.getElementsByTagName("x<")[0] |
12 var child = y.firstChild | 12 var child = y.firstChild |
13 assert_equals(y.parentNode, document.body) | 13 assert_equals(y.parentNode, document.body) |
14 assert_equals(y.ownerDocument, document) | 14 assert_equals(y.ownerDocument, document) |
15 assert_equals(document.adoptNode(y), y) | 15 assert_equals(document.adoptNode(y), y) |
16 assert_equals(y.parentNode, null) | 16 assert_equals(y.parentNode, null) |
17 assert_equals(y.firstChild, child) | 17 assert_equals(y.firstChild, child) |
18 assert_equals(y.ownerDocument, document) | 18 assert_equals(y.ownerDocument, document) |
(...skipping 22 matching lines...) Expand all Loading... |
41 assert_equals(document.adoptNode(doctype), doctype) | 41 assert_equals(document.adoptNode(doctype), doctype) |
42 assert_equals(doctype.parentNode, null) | 42 assert_equals(doctype.parentNode, null) |
43 assert_equals(doctype.ownerDocument, document) | 43 assert_equals(doctype.ownerDocument, document) |
44 }, "Explicitly adopting a DocumentType should work.") | 44 }, "Explicitly adopting a DocumentType should work.") |
45 | 45 |
46 test(function() { | 46 test(function() { |
47 var doc = document.implementation.createDocument(null, null, null) | 47 var doc = document.implementation.createDocument(null, null, null) |
48 assert_throws("NOT_SUPPORTED_ERR", function() { document.adoptNode(doc) }) | 48 assert_throws("NOT_SUPPORTED_ERR", function() { document.adoptNode(doc) }) |
49 }, "Adopting a Document should throw.") | 49 }, "Adopting a Document should throw.") |
50 </script> | 50 </script> |
OLD | NEW |