Title: [210749] trunk/LayoutTests/imported/w3c
Revision
210749
Author
cdu...@apple.com
Date
2017-01-13 16:16:10 -0800 (Fri, 13 Jan 2017)

Log Message

Resync domparsing/ web-platform-tests from upstream
https://bugs.webkit.org/show_bug.cgi?id=167023

Reviewed by Alex Christensen.

Resync domparsing/ web-platform-tests from upstream 4b4b2eeb.

* web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype-expected.txt: Added.
* web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype.html: Added.
* web-platform-tests/domparsing/DOMParser-parseFromString-xml-expected.txt: Added.
* web-platform-tests/domparsing/DOMParser-parseFromString-xml.html: Added.
* web-platform-tests/domparsing/XMLSerializer-serializeToString-expected.txt: Added.
* web-platform-tests/domparsing/XMLSerializer-serializeToString.html: Added.
* web-platform-tests/domparsing/createContextualFragment-expected.txt:
* web-platform-tests/domparsing/createContextualFragment.html:
* web-platform-tests/domparsing/insert_adjacent_html-xhtml-expected.txt: Added.
* web-platform-tests/domparsing/insert_adjacent_html-xhtml.xhtml: Added.
* web-platform-tests/domparsing/style_attribute_html-expected.txt: Added.
* web-platform-tests/domparsing/style_attribute_html.html: Added.
* web-platform-tests/domparsing/w3c-import.log:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (210748 => 210749)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-01-13 23:46:22 UTC (rev 210748)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-01-14 00:16:10 UTC (rev 210749)
@@ -1,3 +1,26 @@
+2017-01-13  Chris Dumez  <cdu...@apple.com>
+
+        Resync domparsing/ web-platform-tests from upstream
+        https://bugs.webkit.org/show_bug.cgi?id=167023
+
+        Reviewed by Alex Christensen.
+
+        Resync domparsing/ web-platform-tests from upstream 4b4b2eeb.
+
+        * web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype-expected.txt: Added.
+        * web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype.html: Added.
+        * web-platform-tests/domparsing/DOMParser-parseFromString-xml-expected.txt: Added.
+        * web-platform-tests/domparsing/DOMParser-parseFromString-xml.html: Added.
+        * web-platform-tests/domparsing/XMLSerializer-serializeToString-expected.txt: Added.
+        * web-platform-tests/domparsing/XMLSerializer-serializeToString.html: Added.
+        * web-platform-tests/domparsing/createContextualFragment-expected.txt:
+        * web-platform-tests/domparsing/createContextualFragment.html:
+        * web-platform-tests/domparsing/insert_adjacent_html-xhtml-expected.txt: Added.
+        * web-platform-tests/domparsing/insert_adjacent_html-xhtml.xhtml: Added.
+        * web-platform-tests/domparsing/style_attribute_html-expected.txt: Added.
+        * web-platform-tests/domparsing/style_attribute_html.html: Added.
+        * web-platform-tests/domparsing/w3c-import.log:
+
 2017-01-11  Youenn Fablet  <you...@apple.com>
 
         Remove request.formData property until it gets implemented

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype-expected.txt (0 => 210749)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype-expected.txt	2017-01-14 00:16:10 UTC (rev 210749)
@@ -0,0 +1,5 @@
+
+PASS Doctype parsing of System Id must fail on ommitted value 
+PASS Doctype parsing of System Id can handle empty string 
+PASS Doctype parsing of System Id can handle a quoted value 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype.html (0 => 210749)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype.html	2017-01-14 00:16:10 UTC (rev 210749)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>HTML entities for various XHTML Doctype variants</title>
+<link rel=help href=""
+<script src=""
+<script src=""
+<div id="log"></div>
+<script>
+  test(function () {
+    var doc = new DOMParser().parseFromString('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"><html><div id="test"/></html>', 'application/xhtml+xml');
+    var div = doc.getElementById('test');
+    assert_equals(div, null); // If null, then this was a an error document (didn't parse the input successfully)
+  }, "Doctype parsing of System Id must fail on ommitted value");
+
+  test(function () {
+    var doc = new DOMParser().parseFromString('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ""><html><div id="test"/></html>', 'application/xhtml+xml');
+    var div = doc.getElementById('test');
+    assert_not_equals(div, null); // If found, then the DOMParser didn't generate an error document
+  }, "Doctype parsing of System Id can handle empty string");
+
+  test(function () {
+    var doc = new DOMParser().parseFromString('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "x"><html><div id="test"/></html>', 'application/xhtml+xml');
+    var div = doc.getElementById('test');
+    assert_not_equals(div, null);
+  }, "Doctype parsing of System Id can handle a quoted value");
+
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-expected.txt (0 => 210749)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-expected.txt	2017-01-14 00:16:10 UTC (rev 210749)
@@ -0,0 +1,18 @@
+
+FAIL Should parse correctly in type text/xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+FAIL XMLDocument interface for correctly parsed document with type text/xml assert_false: Should not be XMLDocument expected false got true
+FAIL Should return an error document for XML wellformedness errors in type text/xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+FAIL XMLDocument interface for incorrectly parsed document with type text/xml assert_false: Should not be XMLDocument expected false got true
+FAIL Should parse correctly in type application/xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+FAIL XMLDocument interface for correctly parsed document with type application/xml assert_false: Should not be XMLDocument expected false got true
+FAIL Should return an error document for XML wellformedness errors in type application/xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+FAIL XMLDocument interface for incorrectly parsed document with type application/xml assert_false: Should not be XMLDocument expected false got true
+FAIL Should parse correctly in type application/xhtml+xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+FAIL XMLDocument interface for correctly parsed document with type application/xhtml+xml assert_false: Should not be XMLDocument expected false got true
+FAIL Should return an error document for XML wellformedness errors in type application/xhtml+xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+FAIL XMLDocument interface for incorrectly parsed document with type application/xhtml+xml assert_false: Should not be XMLDocument expected false got true
+FAIL Should parse correctly in type image/svg+xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+FAIL XMLDocument interface for correctly parsed document with type image/svg+xml assert_false: Should not be XMLDocument expected false got true
+FAIL Should return an error document for XML wellformedness errors in type image/svg+xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+FAIL XMLDocument interface for incorrectly parsed document with type image/svg+xml assert_false: Should not be XMLDocument expected false got true
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml.html (0 => 210749)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml.html	2017-01-14 00:16:10 UTC (rev 210749)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<title>DOMParser</title>
+<link rel="author" title="Ms2ger" href=""
+<script src=""
+<script src=""
+<div id="log"></div>
+<script>
+function checkMetadata(doc, contentType) {
+  assert_true(doc instanceof Document, "Should be Document");
+  assert_equals(doc.URL, document.URL, "URL");
+  assert_equals(doc.documentURI, document.URL, "documentURI");
+  assert_equals(doc.baseURI, document.URL, "baseURI");
+  assert_equals(doc.characterSet, "UTF-8", "characterSet");
+  assert_equals(doc.charset, "UTF-8", "charset");
+  assert_equals(doc.inputEncoding, "UTF-8", "inputEncoding");
+  assert_equals(doc.contentType, contentType, "contentType");
+  assert_equals(doc.location, null, "location");
+}
+
+var allowedTypes = ["text/xml", "application/xml", "application/xhtml+xml", "image/svg+xml"];
+
+allowedTypes.forEach(function(type) {
+  test(function() {
+    var p = new DOMParser();
+    var doc = p.parseFromString("<foo/>", type);
+    assert_true(doc instanceof Document, "Should be Document");
+    checkMetadata(doc, type);
+    assert_equals(doc.documentElement.namespaceURI, null);
+    assert_equals(doc.documentElement.localName, "foo");
+    assert_equals(doc.documentElement.tagName, "foo");
+  }, "Should parse correctly in type " + type);
+
+  test(function() {
+    var p = new DOMParser();
+    var doc = p.parseFromString("<foo/>", type);
+    assert_false(doc instanceof XMLDocument, "Should not be XMLDocument");
+  }, "XMLDocument interface for correctly parsed document with type " + type);
+
+  test(function() {
+    var p = new DOMParser();
+    var doc = p.parseFromString("<foo>", type);
+    checkMetadata(doc, type);
+    assert_equals(doc.documentElement.namespaceURI, "http://www.mozilla.org/newlayout/xml/parsererror.xml");
+    assert_equals(doc.documentElement.localName, "parsererror");
+    assert_equals(doc.documentElement.tagName, "parsererror");
+  }, "Should return an error document for XML wellformedness errors in type " + type);
+
+  test(function() {
+    var p = new DOMParser();
+    var doc = p.parseFromString("<foo>", type);
+    assert_false(doc instanceof XMLDocument, "Should not be XMLDocument");
+  }, "XMLDocument interface for incorrectly parsed document with type " + type);
+});
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/XMLSerializer-serializeToString-expected.txt (0 => 210749)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/XMLSerializer-serializeToString-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/XMLSerializer-serializeToString-expected.txt	2017-01-14 00:16:10 UTC (rev 210749)
@@ -0,0 +1,5 @@
+domparsing_XMLSerializer_serializeToString
+
+
+PASS check  XMLSerializer.serializeToString method could parsing xmldoc to string 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/XMLSerializer-serializeToString.html (0 => 210749)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/XMLSerializer-serializeToString.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/XMLSerializer-serializeToString.html	2017-01-14 00:16:10 UTC (rev 210749)
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML>
+<meta charset=utf-8>
+<html>
+ <head>
+  <title>domparsing Test: XMLSerializer.serializeToString</title>
+  <script src=""
+  <script src=""
+ </head>
+ <body>
+    <h1>domparsing_XMLSerializer_serializeToString</h1>
+  <script>
+        function createXmlDoc(){
+            var input = '<?xml version="1.0" encoding="UTF-8"?><root><child1>value1</child1></root>';
+            var parser = new DOMParser();
+            var doc = parser.parseFromString(input, 'text/xml');
+            return doc;
+        }
+        test(function() {
+            var serializer = new XMLSerializer ();
+            var root = createXmlDoc().documentElement;
+            var xmlString=serializer.serializeToString(root);
+            assert_equals(xmlString, "<root><child1>value1</child1></root>");
+        }, 'check  XMLSerializer.serializeToString method could parsing xmldoc to string');
+  </script>
+ </body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-expected.txt (210748 => 210749)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-expected.txt	2017-01-13 23:46:22 UTC (rev 210748)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-expected.txt	2017-01-14 00:16:10 UTC (rev 210749)
@@ -4,6 +4,26 @@
 PASS Simple test with paragraphs 
 PASS Don't auto-create <body> when applied to <html> 
 PASS <script>s should be run when appended to the document (but not before) 
+FAIL createContextualFragment should work even when the context is <area> The operation is not supported.
+FAIL createContextualFragment should work even when the context is <base> The operation is not supported.
+FAIL createContextualFragment should work even when the context is <basefont> The operation is not supported.
+PASS createContextualFragment should work even when the context is <bgsound> 
+FAIL createContextualFragment should work even when the context is <br> The operation is not supported.
+FAIL createContextualFragment should work even when the context is <col> The operation is not supported.
+FAIL createContextualFragment should work even when the context is <embed> The operation is not supported.
+FAIL createContextualFragment should work even when the context is <frame> The operation is not supported.
+FAIL createContextualFragment should work even when the context is <hr> The operation is not supported.
+FAIL createContextualFragment should work even when the context is <img> The operation is not supported.
+FAIL createContextualFragment should work even when the context is <input> The operation is not supported.
+PASS createContextualFragment should work even when the context is <keygen> 
+FAIL createContextualFragment should work even when the context is <link> The operation is not supported.
+FAIL createContextualFragment should work even when the context is <meta> The operation is not supported.
+FAIL createContextualFragment should work even when the context is <param> The operation is not supported.
+FAIL createContextualFragment should work even when the context is <source> The operation is not supported.
+PASS createContextualFragment should work even when the context is <track> 
+FAIL createContextualFragment should work even when the context is <wbr> The operation is not supported.
+PASS createContextualFragment should work even when the context is <menuitem> 
+FAIL createContextualFragment should work even when the context is <image> The operation is not supported.
 PASS <html> and <body> must work the same, 1 
 PASS <html> and <body> must work the same, 2 
 PASS Implicit <body> creation 
@@ -13,4 +33,5 @@
 PASS null should be stringified 
 PASS undefined should be stringified 
 PASS Text nodes shouldn't be special 
+PASS Non-Element parent should not be special 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment.html (210748 => 210749)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment.html	2017-01-13 23:46:22 UTC (rev 210748)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment.html	2017-01-14 00:16:10 UTC (rev 210749)
@@ -84,6 +84,45 @@
         assert_true(passed, "Fragment created and added to document, should run");
 }, "<script>s should be run when appended to the document (but not before)");
 
+// Historical bugs in browsers; see https://github.com/whatwg/html/issues/2222
+
+[
+        // Void
+        "area",
+        "base",
+        "basefont",
+        "bgsound",
+        "br",
+        "col",
+        "embed",
+        "frame",
+        "hr",
+        "img",
+        "input",
+        "keygen",
+        "link",
+        "meta",
+        "param",
+        "source",
+        "track",
+        "wbr",
+
+        // Historical
+        "menuitem",
+        "image"
+].forEach(name => {
+        test(() => {
+                const range = document.createRange();
+                const contextNode = document.createElement(name);
+                const selectedNode = document.createElement("div");
+                contextNode.appendChild(selectedNode);
+                range.selectNode(selectedNode);
+
+                range.createContextualFragment("some text");
+        }, `createContextualFragment should work even when the context is <${name}>`);
+});
+
+
 // Now that we've established basic sanity, let's do equivalence tests.  Those
 // are easier to write anyway.
 function testEquivalence(element1, fragment1, element2, fragment2) {
@@ -109,6 +148,10 @@
         }
 }
 
+var doc_fragment = document.createDocumentFragment();
+var comment = document.createComment("~o~");
+doc_fragment.appendChild(comment);
+
 var tests = [
         ["<html> and <body> must work the same, 1", document.documentElement, "<span>Hello world</span>", document.body, "<span>Hello world</span>"],
         ["<html> and <body> must work the same, 2", document.documentElement, "<body><p>Hello world", document.body, "<body><p>Hello world"],
@@ -126,6 +169,9 @@
         ["undefined should be stringified", document.createElement("span"), undefined, document.createElement("span"), "undefined"],
         ["Text nodes shouldn't be special",
                 document.createTextNode("?"), "<body><p>",
+                document.createElement("div"), "<body><p>"],
+        ["Non-Element parent should not be special",
+                comment, "<body><p>",
                 document.createElement("div"), "<body><p>"]
 ];
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-xhtml-expected.txt (0 => 210749)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-xhtml-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-xhtml-expected.txt	2017-01-14 00:16:10 UTC (rev 210749)
@@ -0,0 +1,32 @@
+
+PASS beforeBegin content without next sibling 
+PASS Afterbegin content without next sibling 
+PASS BeforeEnd content without next sibling 
+PASS afterend content without next sibling 
+PASS beforeBegin content again, with next sibling 
+PASS Afterbegin content again, with next sibling 
+PASS BeforeEnd content again, with next sibling 
+PASS afterend content again, with next sibling 
+PASS Should throw when inserting with invalid position string 
+PASS When the parent node is null, insertAdjacentHTML should throw for beforebegin and afterend (text) 
+PASS When the parent node is null, insertAdjacentHTML should throw for beforebegin and afterend (comments) 
+PASS When the parent node is null, insertAdjacentHTML should throw for beforebegin and afterend (elements) 
+PASS When the parent node is a document, insertAdjacentHTML should throw for beforebegin and afterend (text) 
+PASS When the parent node is a document, insertAdjacentHTML should throw for beforebegin and afterend (comments) 
+PASS When the parent node is a document, insertAdjacentHTML should throw for beforebegin and afterend (elements) 
+PASS Inserting after being and before end should order things correctly 
+PASS beforeBegin child node not in tree but has parent 
+PASS Afterbegin child node not in tree but has parent 
+PASS BeforeEnd child node not in tree but has parent 
+PASS afterend child node not in tree but has parent 
+PASS Should not run script when appending things which have descendant <script> inserted via insertAdjacentHTML 
+PASS beforeBegin content2 without next sibling 
+PASS Afterbegin content2 without next sibling 
+PASS BeforeEnd content2 without next sibling 
+PASS afterend content2 without next sibling 
+PASS beforeBegin content2 test again, now that there's a next sibling 
+PASS Afterbegin content2 test again, now that there's a next sibling 
+PASS BeforeEnd content2 test again, now that there's a next sibling 
+PASS afterend content2 test again, now that there's a next sibling 
+PASS insertAdjacentHTML in HTML 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-xhtml.xhtml (0 => 210749)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-xhtml.xhtml	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-xhtml.xhtml	2017-01-14 00:16:10 UTC (rev 210749)
@@ -0,0 +1,91 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <title>insertAdjacentHTML in HTML</title>
+  <script src=""
+  <script src=""
+  <script src=""
+</head>
+<body>
+<p id="display"></p><div id="content" style="display: none"></div><div id="content2" style="display: none"></div>
+<script><![CDATA[
+var script_ran = false;
+
+function testPositions(node, testDesc) {
+  test(function() {
+    script_ran = false;
+    node.insertAdjacentHTML("beforeBegin", "\u003Cscript>script_ran = true;\u003C/script><i></i>");
+    assert_equals(node.previousSibling.localName, "i", "Should have had <i> as previous sibling");
+    assert_equals(node.previousSibling.previousSibling.localName, "script", "Should have had <script> as second previous child");
+    assert_false(script_ran, "script should not have run");
+  }, "beforeBegin " + node.id + " " + testDesc)
+
+  test(function() {
+    script_ran = false;
+    node.insertAdjacentHTML("Afterbegin", "<b></b>\u003Cscript>script_ran = true;\u003C/script>");
+    assert_equals(node.firstChild.localName, "b", "Should have had <b> as first child");
+    assert_equals(node.firstChild.nextSibling.localName, "script", "Should have had <script> as second child");
+    assert_false(script_ran, "script should not have run");
+  }, "Afterbegin " + node.id + " " + testDesc);
+
+  test(function() {
+    script_ran = false;
+    node.insertAdjacentHTML("BeforeEnd", "\u003Cscript>script_ran = true;\u003C/script><u></u>");
+    assert_equals(node.lastChild.localName, "u", "Should have had <u> as last child");
+    assert_equals(node.lastChild.previousSibling.localName, "script", "Should have had <script> as penultimate child");
+    assert_false(script_ran, "script should not have run");
+  }, "BeforeEnd " + node.id + " " + testDesc)
+
+  test(function() {
+    script_ran = false;
+    node.insertAdjacentHTML("afterend", "<a></a>\u003Cscript>script_ran = true;\u003C/script>");
+    assert_equals(node.nextSibling.localName, "a", "Should have had <a> as next sibling");
+    assert_equals(node.nextSibling.nextSibling.localName, "script", "Should have had <script> as second next sibling");
+    assert_false(script_ran, "script should not have run");
+  }, "afterend " + node.id + " " + testDesc)
+}
+
+var content = document.getElementById("content");
+testPositions(content, "without next sibling");
+testPositions(content, "again, with next sibling");
+
+test(function() {
+  assert_throws("SYNTAX_ERR", function() {content.insertAdjacentHTML("bar", "foo")});
+  assert_throws("SYNTAX_ERR", function() {content.insertAdjacentHTML("beforebegÄ°n", "foo")});
+  assert_throws("SYNTAX_ERR", function() {content.insertAdjacentHTML("beforebegın", "foo")});
+}, "Should throw when inserting with invalid position string");
+
+var parentElement = document.createElement("div");
+var child = document.createElement("div");
+child.id = "child";
+
+testThrowingNoParent(child, "null");
+testThrowingNoParent(document.documentElement, "a document");
+
+test(function() {
+  child.insertAdjacentHTML("afterBegin", "foo");
+  child.insertAdjacentHTML("beforeend", "bar");
+  assert_equals(child.textContent, "foobar");
+  parentElement.appendChild(child);
+}, "Inserting after being and before end should order things correctly");
+
+testPositions(child, "node not in tree but has parent");
+
+test(function() {
+  script_ran = false;
+  content.appendChild(parentElement); // must not run scripts
+  assert_false(script_ran, "script should not have run");
+}, "Should not run script when appending things which have descendant <script> inserted via insertAdjacentHTML");
+
+var content2 = document.getElementById("content2");
+testPositions(content2, "without next sibling");
+testPositions(content2, "test again, now that there's a next sibling");
+
+// XML-only:
+test(function() {
+  assert_throws("SYNTAX_ERR", function() {content.insertAdjacentHTML("beforeend", "<p>")});
+});
+
+]]></script>
+<div id="log"></div>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/style_attribute_html-expected.txt (0 => 210749)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/style_attribute_html-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/style_attribute_html-expected.txt	2017-01-14 00:16:10 UTC (rev 210749)
@@ -0,0 +1,6 @@
+
+PASS Parsing of initial style attribute 
+PASS Parsing of invalid style attribute 
+PASS Parsing of style attribute 
+PASS Update style.backgroundColor 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/style_attribute_html.html (0 => 210749)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/style_attribute_html.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/style_attribute_html.html	2017-01-14 00:16:10 UTC (rev 210749)
@@ -0,0 +1,52 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Style attribute in HTML</title>
+<script src=""
+<script src=""
+<script>
+
+var div;
+setup(function() {
+    var input = '<div style="color: red">Foo</div>';
+    var doc = (new DOMParser()).parseFromString(input, 'text/html');
+    div = doc.querySelector('div');
+});
+
+test(function() {
+    var style = div.style;
+    assert_equals(style.cssText, 'color: red;');
+    assert_equals(style.color, 'red');
+    assert_equals(div.getAttribute("style"), 'color: red',
+                  'Value of style attribute should match the string value that was set');
+}, 'Parsing of initial style attribute');
+
+test(function() {
+    var style = div.style;
+    div.setAttribute('style', 'color:: invalid');
+    assert_equals(style.cssText, '');
+    assert_equals(style.color, '');
+    assert_equals(div.getAttribute('style'), 'color:: invalid',
+                  'Value of style attribute should match the string value that was set');
+}, 'Parsing of invalid style attribute');
+
+test(function() {
+    var style = div.style;
+    div.setAttribute('style', 'color: green');
+    assert_equals(style.cssText, 'color: green;');
+    assert_equals(style.color, 'green');
+    assert_equals(div.getAttribute('style'), 'color: green',
+                  'Value of style attribute should match the string value that was set');
+}, 'Parsing of style attribute');
+
+test(function() {
+    var style = div.style;
+    style.backgroundColor = 'blue';
+    assert_equals(style.cssText, 'color: green; background-color: blue;',
+                  'Should not drop the existing style');
+    assert_equals(style.color, 'green',
+                  'Should not drop the existing style');
+    assert_equals(div.getAttribute('style'), 'color: green; background-color: blue;',
+                  'Should update style attribute');
+}, 'Update style.backgroundColor');
+
+</script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/w3c-import.log (210748 => 210749)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/w3c-import.log	2017-01-13 23:46:22 UTC (rev 210748)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/w3c-import.log	2017-01-14 00:16:10 UTC (rev 210749)
@@ -16,7 +16,10 @@
 ------------------------------------------------------------------------
 List of files:
 /LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-html.html
+/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype.html
+/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml.html
 /LayoutTests/imported/w3c/web-platform-tests/domparsing/OWNERS
+/LayoutTests/imported/w3c/web-platform-tests/domparsing/XMLSerializer-serializeToString.html
 /LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment.html
 /LayoutTests/imported/w3c/web-platform-tests/domparsing/innerhtml-01.xhtml
 /LayoutTests/imported/w3c/web-platform-tests/domparsing/innerhtml-03.xhtml
@@ -27,6 +30,8 @@
 /LayoutTests/imported/w3c/web-platform-tests/domparsing/insert-adjacent.html
 /LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html.html
 /LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html.js
+/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-xhtml.xhtml
 /LayoutTests/imported/w3c/web-platform-tests/domparsing/outerhtml-01.html
 /LayoutTests/imported/w3c/web-platform-tests/domparsing/outerhtml-02.html
+/LayoutTests/imported/w3c/web-platform-tests/domparsing/style_attribute_html.html
 /LayoutTests/imported/w3c/web-platform-tests/domparsing/xml-serialization.xhtml
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to