Index: LayoutTests/fast/dom/XMLSerializer-element-ns-no-reemit.html |
diff --git a/LayoutTests/fast/dom/XMLSerializer-element-ns-no-reemit.html b/LayoutTests/fast/dom/XMLSerializer-element-ns-no-reemit.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fd4f7f36fb1196012a0c60bdfd7ec132db4ce979 |
--- /dev/null |
+++ b/LayoutTests/fast/dom/XMLSerializer-element-ns-no-reemit.html |
@@ -0,0 +1,28 @@ |
+<!DOCTYPE html> |
+<title>XMLSerializer: Don't emit redundant NS declarations</title> |
+<script src=../../resources/testharness.js></script> |
+<script src=../../resources/testharnessreport.js></script> |
+<div id=log></div> |
+<script> |
+test(function() { |
+ var s = '<foo xmlns="http://www.w3.org/1999/xhtml"></foo>'; |
+ var docFrag = new DOMParser().parseFromString(s, 'text/xml'); |
+ var root = docFrag.removeChild(docFrag.firstChild); |
+ var child = document.createElementNS('http://www.w3.org/1999/xhtml', 'bar'); |
+ child.appendChild(document.createTextNode('')); |
+ root.appendChild(child); |
+ var result1 = new XMLSerializer().serializeToString(root); |
+ assert_equals(result1, '<foo xmlns="http://www.w3.org/1999/xhtml"><bar></bar></foo>'); |
+}, 'XMLSerializer: Don\'t emit redundant declarations of the default NS.'); |
+ |
+test(function() { |
+ var s = '<foo xmlns="http://www.w3.org/1999/xhtml" xmlns:baz="http://example.org/baz"></foo>'; |
+ var docFrag = new DOMParser().parseFromString(s, 'text/xml'); |
+ var root = docFrag.removeChild(docFrag.firstChild); |
+ var child = document.createElementNS('http://example.org/baz', 'baz:bar'); |
+ child.appendChild(document.createTextNode('')); |
+ root.appendChild(child); |
+ var result1 = new XMLSerializer().serializeToString(root); |
+ assert_equals(result1, '<foo xmlns="http://www.w3.org/1999/xhtml" xmlns:baz="http://example.org/baz"><baz:bar></baz:bar></foo>'); |
+}, 'XMLSerializer: Don\'t emit redundant declarations of a prefix.'); |
+</script> |