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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/ChildNode/before.html

Issue 2305903003: DOM append(), prepend(), after(), before(), and replaceWith() should throw an exception if a Docume… (Closed)
Patch Set: Created 4 years, 3 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script> 2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script> 3 <script src="../../../resources/testharnessreport.js"></script>
4 <script> 4 <script>
5 5
6 test(function () { 6 test(function () {
7 var child = document.createElement('p'); 7 var child = document.createElement('p');
8 assert_true('before' in child); 8 assert_true('before' in child);
9 var before = 'mine'; 9 var before = 'mine';
10 var getAttribute = 'mine'; 10 var getAttribute = 'mine';
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 var expected = '1<y></y><x></x>2' + innerHTML; 132 var expected = '1<y></y><x></x>2' + innerHTML;
133 assert_equals(parent.innerHTML, expected); 133 assert_equals(parent.innerHTML, expected);
134 }, nodeName + '.before() with one sibling of child and text as arguments.'); 134 }, nodeName + '.before() with one sibling of child and text as arguments.');
135 135
136 test(function() { 136 test(function() {
137 var x = document.createElement('x'); 137 var x = document.createElement('x');
138 var y = document.createElement('y'); 138 var y = document.createElement('y');
139 x.before(y); 139 x.before(y);
140 assert_equals(x.previousSibling, null); 140 assert_equals(x.previousSibling, null);
141 }, nodeName + '.before() on a child without any parent.'); 141 }, nodeName + '.before() on a child without any parent.');
142
143 test(function() {
144 var parent = document.createElement('div');
145 parent.appendChild(child);
146 var doc2 = document.implementation.createDocument("http://www.w3.org/199 9/xhtml", "html");
147 assert_throws('HierarchyRequestError', () => { child.before(doc2, "foo") });
148 assert_equals(parent.firstChild, child);
149 }, nodeName + '.before() with a Document as an argument should throw.');
142 } 150 }
143 151
144 test_before('Comment'); 152 test_before('Comment');
145 test_before('Element'); 153 test_before('Element');
146 test_before('Text'); 154 test_before('Text');
147 155
148 </script> 156 </script>
149 </html> 157 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698