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

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

Issue 1988983002: Move the dom directory from web-platform-tests/ to wpt/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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 <script src="../../../../resources/testharness.js"></script>
4 <script src="../../../../resources/testharnessreport.js"></script>
5 <div id="log"></div>
6 <script>
7 test(function() {
8 assert_equals(document.parentElement, null)
9 }, "When the parent is null, parentElement should be null")
10 test(function() {
11 assert_equals(document.doctype.parentElement, null)
12 }, "When the parent is a document, parentElement should be null (doctype)")
13 test(function() {
14 assert_equals(document.documentElement.parentElement, null)
15 }, "When the parent is a document, parentElement should be null (element)")
16 test(function() {
17 var comment = document.appendChild(document.createComment("foo"))
18 assert_equals(comment.parentElement, null)
19 }, "When the parent is a document, parentElement should be null (comment)")
20 test(function() {
21 var df = document.createDocumentFragment()
22 assert_equals(df.parentElement, null)
23 var el = document.createElement("div")
24 assert_equals(el.parentElement, null)
25 df.appendChild(el)
26 assert_equals(el.parentNode, df)
27 assert_equals(el.parentElement, null)
28 }, "parentElement should return null for children of DocumentFragments (element) ")
29 test(function() {
30 var df = document.createDocumentFragment()
31 assert_equals(df.parentElement, null)
32 var text = document.createTextNode("bar")
33 assert_equals(text.parentElement, null)
34 df.appendChild(text)
35 assert_equals(text.parentNode, df)
36 assert_equals(text.parentElement, null)
37 }, "parentElement should return null for children of DocumentFragments (text)")
38 test(function() {
39 var df = document.createDocumentFragment()
40 var parent = document.createElement("div")
41 df.appendChild(parent)
42 var el = document.createElement("div")
43 assert_equals(el.parentElement, null)
44 parent.appendChild(el)
45 assert_equals(el.parentElement, parent)
46 }, "parentElement should work correctly with DocumentFragments (element)")
47 test(function() {
48 var df = document.createDocumentFragment()
49 var parent = document.createElement("div")
50 df.appendChild(parent)
51 var text = document.createTextNode("bar")
52 assert_equals(text.parentElement, null)
53 parent.appendChild(text)
54 assert_equals(text.parentElement, parent)
55 }, "parentElement should work correctly with DocumentFragments (text)")
56 test(function() {
57 var parent = document.createElement("div")
58 var el = document.createElement("div")
59 assert_equals(el.parentElement, null)
60 parent.appendChild(el)
61 assert_equals(el.parentElement, parent)
62 }, "parentElement should work correctly in disconnected subtrees (element)")
63 test(function() {
64 var parent = document.createElement("div")
65 var text = document.createTextNode("bar")
66 assert_equals(text.parentElement, null)
67 parent.appendChild(text)
68 assert_equals(text.parentElement, parent)
69 }, "parentElement should work correctly in disconnected subtrees (text)")
70 test(function() {
71 var el = document.createElement("div")
72 assert_equals(el.parentElement, null)
73 document.body.appendChild(el)
74 assert_equals(el.parentElement, document.body)
75 }, "parentElement should work correctly in a document (element)")
76 test(function() {
77 var text = document.createElement("div")
78 assert_equals(text.parentElement, null)
79 document.body.appendChild(text)
80 assert_equals(text.parentElement, document.body)
81 }, "parentElement should work correctly in a document (text)")
82 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698