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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Node-parentElement.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 <title>Node.parentElement</title>
3 <link rel="stylesheet" href="../../../../resources/testharness.css">
4 <script src="../../../../resources/testharness.js"></script>
5 <script src="../../../../resources/testharnessreport.js"></script>
6 <div id="log"></div>
7 <script>
8 test(function() {
9 assert_equals(document.parentElement, null)
10 }, "When the parent is null, parentElement should be null")
11 test(function() {
12 assert_equals(document.doctype.parentElement, null)
13 }, "When the parent is a document, parentElement should be null (doctype)")
14 test(function() {
15 assert_equals(document.documentElement.parentElement, null)
16 }, "When the parent is a document, parentElement should be null (element)")
17 test(function() {
18 var comment = document.appendChild(document.createComment("foo"))
19 assert_equals(comment.parentElement, null)
20 }, "When the parent is a document, parentElement should be null (comment)")
21 test(function() {
22 var df = document.createDocumentFragment()
23 assert_equals(df.parentElement, null)
24 var el = document.createElement("div")
25 assert_equals(el.parentElement, null)
26 df.appendChild(el)
27 assert_equals(el.parentNode, df)
28 assert_equals(el.parentElement, null)
29 }, "parentElement should return null for children of DocumentFragments (element) ")
30 test(function() {
31 var df = document.createDocumentFragment()
32 assert_equals(df.parentElement, null)
33 var text = document.createTextNode("bar")
34 assert_equals(text.parentElement, null)
35 df.appendChild(text)
36 assert_equals(text.parentNode, df)
37 assert_equals(text.parentElement, null)
38 }, "parentElement should return null for children of DocumentFragments (text)")
39 test(function() {
40 var df = document.createDocumentFragment()
41 var parent = document.createElement("div")
42 df.appendChild(parent)
43 var el = document.createElement("div")
44 assert_equals(el.parentElement, null)
45 parent.appendChild(el)
46 assert_equals(el.parentElement, parent)
47 }, "parentElement should work correctly with DocumentFragments (element)")
48 test(function() {
49 var df = document.createDocumentFragment()
50 var parent = document.createElement("div")
51 df.appendChild(parent)
52 var text = document.createTextNode("bar")
53 assert_equals(text.parentElement, null)
54 parent.appendChild(text)
55 assert_equals(text.parentElement, parent)
56 }, "parentElement should work correctly with DocumentFragments (text)")
57 test(function() {
58 var parent = document.createElement("div")
59 var el = document.createElement("div")
60 assert_equals(el.parentElement, null)
61 parent.appendChild(el)
62 assert_equals(el.parentElement, parent)
63 }, "parentElement should work correctly in disconnected subtrees (element)")
64 test(function() {
65 var parent = document.createElement("div")
66 var text = document.createTextNode("bar")
67 assert_equals(text.parentElement, null)
68 parent.appendChild(text)
69 assert_equals(text.parentElement, parent)
70 }, "parentElement should work correctly in disconnected subtrees (text)")
71 test(function() {
72 var el = document.createElement("div")
73 assert_equals(el.parentElement, null)
74 document.body.appendChild(el)
75 assert_equals(el.parentElement, document.body)
76 }, "parentElement should work correctly in a document (element)")
77 test(function() {
78 var text = document.createElement("div")
79 assert_equals(text.parentElement, null)
80 document.body.appendChild(text)
81 assert_equals(text.parentElement, document.body)
82 }, "parentElement should work correctly in a document (text)")
83 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698