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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/ChildNode/replace-with.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('replaceWith' in child); 8 assert_true('replaceWith' in child);
9 var replaceWith = 'mine'; 9 var replaceWith = 'mine';
10 var getAttribute = 'mine'; 10 var getAttribute = 'mine';
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 test(function() { 118 test(function() {
119 var parent = document.createElement('div'); 119 var parent = document.createElement('div');
120 var x = document.createElement('x'); 120 var x = document.createElement('x');
121 var y = document.createElement('y'); 121 var y = document.createElement('y');
122 parent.appendChild(x); 122 parent.appendChild(x);
123 parent.appendChild(y); 123 parent.appendChild(y);
124 child.replaceWith(x, y); 124 child.replaceWith(x, y);
125 assert_equals(parent.innerHTML, '<x></x><y></y>'); 125 assert_equals(parent.innerHTML, '<x></x><y></y>');
126 }, nodeName + '.replaceWith() on a parenless child with two elements as argu ments.'); 126 }, nodeName + '.replaceWith() on a parenless child with two elements as argu ments.');
127
128 test(function() {
129 var parent = document.createElement('div');
130 parent.appendChild(child);
131 var doc2 = document.implementation.createDocument("http://www.w3.org/199 9/xhtml", "html");
132 assert_throws('HierarchyRequestError', () => { child.replaceWith(doc2, " foo") });
133 assert_equals(parent.firstChild, child);
134 }, nodeName + '.replaceWith() with a Document as an argument should throw.') ;
127 } 135 }
128 136
129 test_replaceWith('Comment'); 137 test_replaceWith('Comment');
130 test_replaceWith('Element'); 138 test_replaceWith('Element');
131 test_replaceWith('Text'); 139 test_replaceWith('Text');
132 140
133 </script> 141 </script>
134 </html> 142 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698