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

Unified Diff: LayoutTests/fast/dom/XMLSerializer-element-ns-no-reemit.html

Issue 184633007: Don't emit a default namespace declaration if it's already the default (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/inspector/elements/set-outer-html-for-xhtml-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/inspector/elements/set-outer-html-for-xhtml-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698