| Index: LayoutTests/fast/dom/ChildNode/replace-with.html
|
| diff --git a/LayoutTests/fast/dom/ChildNode/replace-with.html b/LayoutTests/fast/dom/ChildNode/replace-with.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2326f8b78d5235bfae7d4ff1a862902908cbf406
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/dom/ChildNode/replace-with.html
|
| @@ -0,0 +1,64 @@
|
| +<!DOCTYPE html>
|
| +<script src="../../../resources/testharness.js"></script>
|
| +<script src="../../../resources/testharnessreport.js"></script>
|
| +<script>
|
| +
|
| +test(function() {
|
| + var node = document.createComment('node');
|
| + assert_true('replaceWith' in node);
|
| + assert_equals(typeof node.replaceWith, 'function');
|
| + assert_equals(node.replaceWith.length, 0);
|
| +}, 'Comment should support before()');
|
| +
|
| +test(function() {
|
| + var node = document.createElement('node');
|
| + assert_true('replaceWith' in node);
|
| + assert_equals(typeof node.replaceWith, 'function');
|
| + assert_equals(node.replaceWith.length, 0);
|
| +}, 'Element should support before()');
|
| +
|
| +test(function() {
|
| + var node = document.createTextNode('node');
|
| + assert_true('replaceWith' in node);
|
| + assert_equals(typeof node.replaceWith, 'function');
|
| + assert_equals(node.replaceWith.length, 0);
|
| +}, 'Text should support before()');
|
| +
|
| +test(function() {
|
| + var parent = document.createElement('div');
|
| + var test = document.createComment('test');
|
| + parent.appendChild(test);
|
| + var x = document.createComment('x');
|
| +
|
| + assert_equals(test.parentNode, parent, 'Appended node should have a parent');
|
| + assert_array_equals(parent.childNodes, [test], 'ParentNode should have 1 child test');
|
| + test.replaceWith(x);
|
| + assert_array_equals(parent.childNodes, [x], 'ParentNode should have 1 child node');
|
| +}, 'replaceWith() should work for Comment');
|
| +
|
| +test(function() {
|
| + var parent = document.createElement('div');
|
| + var test = document.createElement('test');
|
| + parent.appendChild(test);
|
| + var x = document.createElement('x');
|
| +
|
| + assert_equals(test.parentNode, parent, 'Appended node should have a parent');
|
| + assert_array_equals(parent.childNodes, [test], 'ParentNode should have 1 child test');
|
| + test.replaceWith(x);
|
| + assert_array_equals(parent.childNodes, [x], 'ParentNode should have 1 child node');
|
| +}, 'replaceWith() should work for Element');
|
| +
|
| +test(function() {
|
| + var parent = document.createElement('div');
|
| + var test = document.createTextNode('test');
|
| + parent.appendChild(test);
|
| + var x = document.createTextNode('x');
|
| +
|
| + assert_equals(test.parentNode, parent, 'Appended node should have a parent');
|
| + assert_array_equals(parent.childNodes, [test], 'ParentNode should have 1 child test');
|
| + test.replaceWith(x);
|
| + assert_array_equals(parent.childNodes, [x], 'ParentNode should have 1 child node');
|
| +}, 'replaceWith() should work for Text');
|
| +
|
| +</script>
|
| +</html>
|
|
|