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

Unified Diff: LayoutTests/fast/dom/XMLSerializer-entities.html

Issue 26193002: XMLSerializer escapes < > & correctly inside <script> and <style> tags. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed feedback. Created 7 years, 1 month 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
Index: LayoutTests/fast/dom/XMLSerializer-entities.html
diff --git a/LayoutTests/fast/dom/XMLSerializer-entities.html b/LayoutTests/fast/dom/XMLSerializer-entities.html
new file mode 100644
index 0000000000000000000000000000000000000000..dd1ad6871d40e6ad716ef2e049c5475395fe8e11
--- /dev/null
+++ b/LayoutTests/fast/dom/XMLSerializer-entities.html
@@ -0,0 +1,35 @@
+<html>
+<head>
+ <script type="text/javascript">
+ function runTest()
+ {
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ var ns = 'http://www.w3.org/1999/xhtml';
+ var xhtml = document.implementation.createDocument(ns , 'html', null);
+
+ var p = xhtml.createElementNS(ns, 'p');
+ p.textContent = '(0 < 1 && 1 > 0)';
+ xhtml.documentElement.appendChild(p);
+
+ var script = xhtml.createElementNS(ns, 'script');
+ script.textContent = 'if (0 < 1 && 1 > 0) { };';
+ xhtml.documentElement.appendChild(script);
+
+ var style = xhtml.createElementNS(ns, 'style');
+ style.textContent = '/* < > & */';
+ xhtml.documentElement.appendChild(style);
+
+ var serializer = new XMLSerializer();
+ var xmlString = serializer.serializeToString(xhtml);
+
+ var outputText = document.getElementById("output");
+ outputText.textContent = xmlString;
+ }
+ </script>
+</head>
+ <body onload="runTest()">
+ <div id="output"/>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698