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

Unified Diff: LayoutTests/fast/dom/dom-parser-text-html-mimetype-support.html

Issue 23903014: DOMParser.parseFromString() should support creating HTML Document with mimetype text/html (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/dom/dom-parser-text-html-mimetype-support.html
diff --git a/LayoutTests/fast/dom/dom-parser-text-html-mimetype-support.html b/LayoutTests/fast/dom/dom-parser-text-html-mimetype-support.html
new file mode 100644
index 0000000000000000000000000000000000000000..d6bda3357c6385bed2acb64b6209f4b41c14622f
--- /dev/null
+++ b/LayoutTests/fast/dom/dom-parser-text-html-mimetype-support.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function parseHTMLContent()
+{
+ var htmlContent =
+ "<!DOCTYPE html>" +
+ "<html>" +
+ "<head>" +
+ "<noscript>" +
+ "<p>Scripts must be disabled for the document created using DOMParser.parseFromString()</p>" +
+ "</noscript>" +
+ "</head>" +
+ "<body>" +
+ "<div id='text'></div>" +
+ "<script>document.getElementById('text').textContent = 'Newly added text';<\/script>" +
+ "</body>" +
+ "</html>";
+ var parser = new DOMParser();
+ var htmlDocument = parser.parseFromString(htmlContent, "text/html");
+ if (!htmlDocument)
+ document.getElementById("result").textContent = "FAIL";
+ else {
+ document.getElementById("result").textContent = "PASS";
+ document.getElementById("content").innerHTML = htmlDocument.documentElement.innerHTML;
+ }
+}
+
+function runTest()
+{
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ }
+ parseHTMLContent();
+}
+</script>
+</head>
+<body onload="runTest();">
+<p>This tests DOMParser supports creating Document for HTML content with mime-type "text/html".</p>
+<div id="content"></div>
+<div id="result"></div>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/dom-parser-text-html-mimetype-support-expected.txt » ('j') | Source/core/xml/DOMParser.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698