Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Document-adoptNode.html

Issue 1529523002: Import dom/ from web-platform-tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak W3CImportExpectations Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <meta charset=utf-8>
3 <title>Document.adoptNode</title>
4 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-adoptnode">
5 <script src="../../../../resources/testharness.js"></script>
6 <script src="../../../../resources/testharnessreport.js"></script>
7 <div id="log"></div>
8 <!-- creates an element with local name "x<": --><x<>x</x<>
9 <script>
10 test(function() {
11 var y = document.getElementsByTagName("x<")[0]
12 var child = y.firstChild
13 assert_equals(y.parentNode, document.body)
14 assert_equals(y.ownerDocument, document)
15 assert_equals(document.adoptNode(y), y)
16 assert_equals(y.parentNode, null)
17 assert_equals(y.firstChild, child)
18 assert_equals(y.ownerDocument, document)
19 assert_equals(child.ownerDocument, document)
20 var doc = document.implementation.createDocument(null, null, null)
21 assert_equals(doc.adoptNode(y), y)
22 assert_equals(y.parentNode, null)
23 assert_equals(y.firstChild, child)
24 assert_equals(y.ownerDocument, doc)
25 assert_equals(child.ownerDocument, doc)
26 }, "Adopting an Element called 'x<' should work.")
27
28 test(function() {
29 var x = document.createElement(":good:times:")
30 assert_equals(document.adoptNode(x), x);
31 var doc = document.implementation.createDocument(null, null, null)
32 assert_equals(doc.adoptNode(x), x)
33 assert_equals(x.parentNode, null)
34 assert_equals(x.ownerDocument, doc)
35 }, "Adopting an Element called ':good:times:' should work.")
36
37 test(function() {
38 var doctype = document.doctype;
39 assert_equals(doctype.parentNode, document)
40 assert_equals(doctype.ownerDocument, document)
41 assert_equals(document.adoptNode(doctype), doctype)
42 assert_equals(doctype.parentNode, null)
43 assert_equals(doctype.ownerDocument, document)
44 }, "Explicitly adopting a DocumentType should work.")
45
46 test(function() {
47 var doc = document.implementation.createDocument(null, null, null)
48 assert_throws("NOT_SUPPORTED_ERR", function() { document.adoptNode(doc) })
49 }, "Adopting a Document should throw.")
50 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698