Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (243812 => 243813)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2019-04-03 17:45:17 UTC (rev 243812)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2019-04-03 17:48:31 UTC (rev 243813)
@@ -1,3 +1,15 @@
+2019-04-03 Chris Dumez <[email protected]>
+
+ Re-sync web-platform-tests/domparsing from upstream
+ https://bugs.webkit.org/show_bug.cgi?id=196544
+
+ Reviewed by Alex Christensen.
+
+ Re-sync web-platform-tests/domparsing from upstream 3bfdeb8976fc5.
+
+ * web-platform-tests/domparsing/*: Updated
+ * web-platform-tests/interfaces/DOM-Parsing.idl: Added.
+
2019-04-03 Sihui Liu <[email protected]>
Blob type cannot be stored correctly in IDB when IDBObjectStore has autoIncrement and keyPath options
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype.html (243812 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype.html 2019-04-03 17:45:17 UTC (rev 243812)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype.html 2019-04-03 17:48:31 UTC (rev 243813)
@@ -2,8 +2,8 @@
<meta charset=utf-8>
<title>HTML entities for various XHTML Doctype variants</title>
<link rel=help href=""
-<script src=""
-<script src=""
+<script src=""
+<script src=""
<div id="log"></div>
<script>
test(function () {
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror-expected.txt (0 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror-expected.txt 2019-04-03 17:48:31 UTC (rev 243813)
@@ -0,0 +1,19 @@
+
+FAIL DOMParser: <parsererror> element added on error, <span x:test="testing">1</span> assert_equals: expecting one parsererror expected 1 but got 0
+PASS DOMParser: <parsererror> element added on error, < span>2</span>
+FAIL DOMParser: <parsererror> element added on error, <span :test="testing">3</span> assert_equals: expecting one parsererror expected 1 but got 0
+PASS DOMParser: <parsererror> element added on error, <span><em>4</span></em>
+PASS DOMParser: <parsererror> element added on error, <span>5
+PASS DOMParser: <parsererror> element added on error, 6</span>
+PASS DOMParser: <parsererror> element added on error, <span>7< /span>
+PASS DOMParser: <parsererror> element added on error, <span>8</ span>
+PASS DOMParser: <parsererror> element added on error, <span novalue>9</span>
+PASS DOMParser: <parsererror> element added on error, <span ="noattr">10</span>
+FAIL DOMParser: <parsererror> element added on error, <span ::="test">11</span> assert_equals: expecting one parsererror expected 1 but got 0
+FAIL DOMParser: <parsererror> element added on error, <span xmlns:="urn:x-test:test">12</span> assert_equals: expecting one parsererror expected 1 but got 0
+PASS DOMParser: <parsererror> element added on error, <span xmlns:xmlns="">13</span>
+PASS DOMParser: <parsererror> element added on error, <span data-test=testing>14</span>
+PASS DOMParser: <parsererror> element added on error, 15<span
+PASS DOMParser: <parsererror> element added on error, <8:test xmlns:8="urn:x-test:test">16</8:test>
+PASS DOMParser: <parsererror> element added on error, <span xmlns:p1 xmlns:p2="urn:x-test:test"/>17
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror.html (0 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror.html 2019-04-03 17:48:31 UTC (rev 243813)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<title>DOMParser: <parsererror> element added on error</title>
+<script src=""
+<script src=""
+<script>
+const xhtml_prologue = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"' +
+ ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n' +
+ '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n' +
+ '<body>\n',
+ xhtml_epilogue = '</body>\n</html>\n';
+
+[
+ '<span x:test="testing">1</span>', // undeclared 'x' namespace prefix
+ '< span>2</span>', // bad start tag
+ '<span :test="testing">3</span>', // empty namespace prefix
+ '<span><em>4</span></em>', // staggered tags
+ '<span>5', // missing end </span> tag
+ '6</span>', // missing start <span> tag
+ '<span>7< /span>', // bad end tag
+ '<span>8</ span>', // bad end tag
+ '<span novalue>9</span>', // missing attribute value
+ '<span ="noattr">10</span>', // missing attribute name
+ '<span ::="test">11</span>', // bad namespace prefix
+ '<span xmlns:="urn:x-test:test">12</span>', // missing namespace prefix
+ '<span xmlns:xmlns="">13</span>', // invalid namespace prefix
+ '<span data-test=testing>14</span>', // unquoted attribute value
+ '15<span', // bad start tag
+ '<8:test xmlns:8="urn:x-test:test">16</8:test>', // invalid namespace prefix
+ '<span xmlns:p1 xmlns:p2="urn:x-test:test"/>17', // missing namespace URI
+].forEach(fragment => {
+ test(() => {
+ var document_string = xhtml_prologue + fragment + xhtml_epilogue;
+ var doc = (new DOMParser).parseFromString(document_string, "application/xhtml+xml");
+ var parsererrors = doc.getElementsByTagName("parsererror");
+ assert_equals(parsererrors.length, 1, 'expecting one parsererror');
+ }, document.title + ', ' + fragment);
+});
+</script>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml.html (243812 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml.html 2019-04-03 17:45:17 UTC (rev 243812)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml.html 2019-04-03 17:48:31 UTC (rev 243813)
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<title>DOMParser</title>
<link rel="author" title="Ms2ger" href=""
-<script src=""
-<script src=""
+<script src=""
+<script src=""
<div id="log"></div>
<script>
function checkMetadata(doc, contentType) {
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/META.yml (0 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/META.yml (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/META.yml 2019-04-03 17:48:31 UTC (rev 243813)
@@ -0,0 +1,4 @@
+spec: https://w3c.github.io/DOM-Parsing/
+suggested_reviewers:
+ - ChrisParis
+ - jdm
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/OWNERS (243812 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/OWNERS 2019-04-03 17:45:17 UTC (rev 243812)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/OWNERS 2019-04-03 17:48:31 UTC (rev 243813)
@@ -1,2 +0,0 @@
-@ChrisParis
-@jdm
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/XMLSerializer-serializeToString-expected.txt (243812 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/XMLSerializer-serializeToString-expected.txt 2019-04-03 17:45:17 UTC (rev 243812)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/XMLSerializer-serializeToString-expected.txt 2019-04-03 17:48:31 UTC (rev 243813)
@@ -1,5 +1,24 @@
domparsing_XMLSerializer_serializeToString
-PASS check XMLSerializer.serializeToString method could parsing xmldoc to string
+PASS check XMLSerializer.serializeToString method could parsing xmldoc to string
+PASS Check if the default namespace is correctly reset.
+FAIL Check if there is no redundant empty namespace declaration. assert_equals: expected "<root xmlns=\"urn:bar\"><outer xmlns=\"\"><inner>value1</inner></outer></root>" but got "<root xmlns=\"urn:bar\"><outer xmlns=\"\"><inner xmlns=\"\">value1</inner></outer></root>"
+FAIL Check if redundant xmlns="..." is dropped. assert_equals: expected "<root><child/></root>" but got "<root><child xmlns=\"\"/></root>"
+FAIL Check if inconsistent xmlns="..." is dropped. assert_equals: expected "<root xmlns=\"uri1\"><child xmlns=\"\"/><child2 xmlns=\"uri2\"/><child3/><child4 xmlns=\"uri4\"/><child5 xmlns=\"\"/></root>" but got "<root xmlns=\"uri1\"><child xmlns=\"FAIL1\"/><child2 xmlns=\"FAIL2\"/><child3 xmlns=\"FAIL3\"/><child4 xmlns=\"uri4\"/><child5 xmlns=\"\"/></root>"
+PASS Check if an attribute with namespace and no prefix is serialized with the nearest-declared prefix
+FAIL Check if an attribute with namespace and no prefix is serialized with the nearest-declared prefix even if the prefix is assigned to another namespace. assert_equals: expected "<el1 xmlns:p=\"u1\" xmlns:q=\"u1\"><el2 xmlns:q=\"u2\" q:name=\"v\"/></el1>" but got "<el1 xmlns:p=\"u1\" xmlns:q=\"u1\"><el2 xmlns:q=\"u2\" q:name=\"v\" xmlns:q=\"u1\"/></el1>"
+PASS Check if the prefix of an attribute is replaced with another existing prefix mapped to the same namespace URI.
+FAIL Check if the prefix of an attribute is NOT preserved in a case where neither its prefix nor its namespace URI is not already used. assert_equals: expected "<r xmlns:xx=\"uri\" xmlns:ns1=\"uri2\" ns1:name=\"value\"/>" but got "<r xmlns:xx=\"uri\" p:name=\"value\" xmlns:p=\"uri2\"/>"
+FAIL Check if the prefix of an attribute is replaced with a generated one in a case where the prefix is already mapped to a different namespace URI. assert_equals: expected "<r xmlns:xx=\"uri\" xmlns:ns1=\"uri2\" ns1:name=\"value\"/>" but got "<r xmlns:xx=\"uri\" NS1:name=\"value\" xmlns:NS1=\"uri2\"/>"
+FAIL check XMLSerializer.serializeToString escapes attribute values for roundtripping assert_in_array: value "<root attr=\"\t\"/>" not in array ["<root attr=\"	\"/>", "<root attr=\"	\"/>"]
+FAIL Check if attribute serialization takes into account of following xmlns:* attributes assert_equals: expected "<root xmlns:ns1=\"uri1\" ns1:foobar=\"value1\" xmlns:p=\"uri2\"/>" but got "<root p:foobar=\"value1\" xmlns:p=\"uri1\" xmlns:p=\"uri2\"/>"
+FAIL Check if attribute serialization takes into account of the same prefix declared in an ancestor element assert_equals: expected "<root xmlns:p=\"uri1\"><child xmlns:ns1=\"uri2\" ns1:foobar=\"v\"/></root>" but got "<root xmlns:p=\"uri1\"><child NS1:foobar=\"v\" xmlns:NS1=\"uri2\"/></root>"
+FAIL Check if start tag serialization drops element prefix if the namespace is same as inherited default namespace. assert_equals: expected "<root xmlns=\"u1\"><child xmlns:p=\"u1\"/></root>" but got "<root xmlns=\"u1\"><p:child xmlns:p=\"u1\"/></root>"
+FAIL Check if start tag serialization finds an appropriate prefix. assert_equals: expected "<root xmlns:p1=\"u1\"><child xmlns:p2=\"u1\"><p2:child2/></child></root>" but got "<root xmlns:p1=\"u1\"><child xmlns:p2=\"u1\"><child2 xmlns=\"u1\"/></child></root>"
+FAIL Check if start tag serialization takes into account of its xmlns:* attributes assert_equals: expected "<ns1:root xmlns:ns1=\"uri1\" xmlns:p=\"uri2\"/>" but got "<p:root xmlns:p=\"uri2\"/>"
+PASS Check if start tag serialization applied the original prefix even if it is declared in an ancestor element.
+FAIL Check if generated prefixes match to "ns${index}". assert_equals: expected "<root><child1 xmlns:ns1=\"uri1\" ns1:attr1=\"value1\" xmlns:ns2=\"uri2\" ns2:attr2=\"value2\"/><child2 xmlns:ns3=\"uri3\" ns3:attr3=\"value3\"/></root>" but got "<root><child1 NS1:attr1=\"value1\" xmlns:NS1=\"uri1\" NS2:attr2=\"value2\" xmlns:NS2=\"uri2\"/><child2 NS3:attr3=\"value3\" xmlns:NS3=\"uri3\"/></root>"
+FAIL Check if "ns1" is generated even if the element already has xmlns:ns1. assert_equals: expected "<root xmlns:ns2=\"uri2\"><child xmlns:ns1=\"uri1\" xmlns:ns1=\"uri3\" ns1:attr1=\"value1\"/></root>" but got "<root xmlns:ns2=\"uri2\"><child xmlns:ns1=\"uri1\" NS1:attr1=\"value1\" xmlns:NS1=\"uri3\"/></root>"
+FAIL Check if no special handling for XLink namespace unlike HTML serializer. assert_equals: expected "<root xmlns:ns1=\"http://www.w3.org/1999/xlink\" ns1:href="" but got "<root NS1:href="" xmlns:NS1=\"http://www.w3.org/1999/xlink\"/>"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/XMLSerializer-serializeToString.html (243812 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/XMLSerializer-serializeToString.html 2019-04-03 17:45:17 UTC (rev 243812)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/XMLSerializer-serializeToString.html 2019-04-03 17:48:31 UTC (rev 243813)
@@ -3,24 +3,207 @@
<html>
<head>
<title>domparsing Test: XMLSerializer.serializeToString</title>
- <script src=""
- <script src=""
+ <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>
+const XMLNS_URI = 'http://www.w3.org/2000/xmlns/';
+
+function createXmlDoc(){
+ var input = '<?xml version="1.0" encoding="UTF-8"?><root><child1>value1</child1></root>';
+ var parser = new DOMParser();
+ return parser.parseFromString(input, 'text/xml');
+}
+
+// Returns the root element.
+function parse(xmlString) {
+ return (new DOMParser()).parseFromString(xmlString, 'text/xml').documentElement;
+}
+
+function serialize(node) {
+ return (new XMLSerializer()).serializeToString(node);
+}
+
+test(function() {
+ var root = createXmlDoc().documentElement;
+ assert_equals(serialize(root), '<root><child1>value1</child1></root>');
+}, 'check XMLSerializer.serializeToString method could parsing xmldoc to string');
+
+test(function() {
+ var root = createXmlDoc().documentElement;
+ var element = root.ownerDocument.createElementNS('urn:foo', 'another');
+ var child1 = root.firstChild;
+ root.replaceChild(element, child1);
+ element.appendChild(child1);
+ assert_equals(serialize(root), '<root><another xmlns="urn:foo"><child1 xmlns="">value1</child1></another></root>');
+}, 'Check if the default namespace is correctly reset.');
+
+test(function() {
+ var root = parse('<root xmlns="urn:bar"><outer xmlns=""><inner>value1</inner></outer></root>');
+ assert_equals(serialize(root), '<root xmlns="urn:bar"><outer xmlns=""><inner>value1</inner></outer></root>');
+}, 'Check if there is no redundant empty namespace declaration.');
+
+test(function() {
+ assert_equals(serialize(parse('<root><child xmlns=""/></root>')),
+ '<root><child/></root>');
+ assert_equals(serialize(parse('<root xmlns=""><child xmlns=""/></root>')),
+ '<root><child/></root>');
+ assert_equals(serialize(parse('<root xmlns="u1"><child xmlns="u1"/></root>')),
+ '<root xmlns="u1"><child/></root>');
+}, 'Check if redundant xmlns="..." is dropped.');
+
+test(function() {
+ const root = parse('<root xmlns="uri1"/>');
+ const child = root.ownerDocument.createElement('child');
+ child.setAttributeNS(XMLNS_URI, 'xmlns', 'FAIL1');
+ root.appendChild(child);
+ const child2 = root.ownerDocument.createElementNS('uri2', 'child2');
+ child2.setAttributeNS(XMLNS_URI, 'xmlns', 'FAIL2');
+ root.appendChild(child2);
+ const child3 = root.ownerDocument.createElementNS('uri1', 'child3');
+ child3.setAttributeNS(XMLNS_URI, 'xmlns', 'FAIL3');
+ root.appendChild(child3);
+ const child4 = root.ownerDocument.createElementNS('uri4', 'child4');
+ child4.setAttributeNS(XMLNS_URI, 'xmlns', 'uri4');
+ root.appendChild(child4);
+ const child5 = root.ownerDocument.createElement('child5');
+ child5.setAttributeNS(XMLNS_URI, 'xmlns', '');
+ root.appendChild(child5);
+ assert_equals(serialize(root), '<root xmlns="uri1"><child xmlns=""/><child2 xmlns="uri2"/><child3/><child4 xmlns="uri4"/><child5 xmlns=""/></root>');
+}, 'Check if inconsistent xmlns="..." is dropped.');
+
+test(function() {
+ let root = parse('<r xmlns:xx="uri"></r>');
+ root.setAttributeNS('uri', 'name', 'v');
+ assert_equals(serialize(root), '<r xmlns:xx="uri" xx:name="v"/>');
+
+ let root2 = parse('<r xmlns:xx="uri"><b/></r>');
+ let child = root2.firstChild;
+ child.setAttributeNS('uri', 'name', 'v');
+ assert_equals(serialize(root2), '<r xmlns:xx="uri"><b xx:name="v"/></r>');
+
+ let root3 = parse('<r xmlns:x0="uri" xmlns:x2="uri"><b xmlns:x1="uri"/></r>');
+ let child3 = root3.firstChild;
+ child3.setAttributeNS('uri', 'name', 'v');
+ assert_equals(serialize(root3),
+ '<r xmlns:x0="uri" xmlns:x2="uri"><b xmlns:x1="uri" x1:name="v"/></r>',
+ 'Should choose the nearest prefix');
+}, 'Check if an attribute with namespace and no prefix is serialized with the nearest-declared prefix');
+
+test(function() {
+ let root = parse('<el1 xmlns:p="u1" xmlns:q="u1"><el2 xmlns:q="u2"/></el1>');
+ root.firstChild.setAttributeNS('u1', 'name', 'v');
+ assert_equals(serialize(root),
+ '<el1 xmlns:p="u1" xmlns:q="u1"><el2 xmlns:q="u2" q:name="v"/></el1>');
+ // Maybe this is a specification error.
+}, 'Check if an attribute with namespace and no prefix is serialized with the nearest-declared prefix even if the prefix is assigned to another namespace.');
+
+test(function() {
+ let root = parse('<r xmlns:xx="uri"></r>');
+ root.setAttributeNS('uri', 'p:name', 'v');
+ assert_equals(serialize(root), '<r xmlns:xx="uri" xx:name="v"/>');
+
+ let root2 = parse('<r xmlns:xx="uri"><b/></r>');
+ let child = root2.firstChild;
+ child.setAttributeNS('uri', 'p:name', 'value');
+ assert_equals(serialize(root2),
+ '<r xmlns:xx="uri"><b xx:name="value"/></r>');
+}, 'Check if the prefix of an attribute is replaced with another existing prefix mapped to the same namespace URI.');
+
+test(function() {
+ let root = parse('<r xmlns:xx="uri"></r>');
+ root.setAttributeNS('uri2', 'p:name', 'value');
+ assert_equals(serialize(root),
+ '<r xmlns:xx="uri" xmlns:ns1="uri2" ns1:name="value"/>');
+}, 'Check if the prefix of an attribute is NOT preserved in a case where neither its prefix nor its namespace URI is not already used.');
+
+test(function() {
+ let root = parse('<r xmlns:xx="uri"></r>');
+ root.setAttributeNS('uri2', 'xx:name', 'value');
+ assert_equals(serialize(root),
+ '<r xmlns:xx="uri" xmlns:ns1="uri2" ns1:name="value"/>');
+}, 'Check if the prefix of an attribute is replaced with a generated one in a case where the prefix is already mapped to a different namespace URI.');
+
+test(function() {
+ var root = parse('<root />');
+ root.setAttribute('attr', '\t');
+ assert_in_array(serialize(root), [
+ '<root attr="	"/>', '<root attr="	"/>']);
+ root.setAttribute('attr', '\n');
+ assert_in_array(serialize(root), [
+ '<root attr="
"/>', '<root attr=" "/>']);
+ root.setAttribute('attr', '\r');
+ assert_in_array(serialize(root), [
+ '<root attr="
"/>', '<root attr=" "/>']);
+}, 'check XMLSerializer.serializeToString escapes attribute values for roundtripping');
+
+test(function() {
+ const root = (new Document()).createElement('root');
+ root.setAttributeNS('uri1', 'p:foobar', 'value1');
+ root.setAttributeNS(XMLNS_URI, 'xmlns:p', 'uri2');
+ assert_equals(serialize(root), '<root xmlns:ns1="uri1" ns1:foobar="value1" xmlns:p="uri2"/>');
+}, 'Check if attribute serialization takes into account of following xmlns:* attributes');
+
+test(function() {
+ const root = parse('<root xmlns:p="uri1"><child/></root>');
+ root.firstChild.setAttributeNS('uri2', 'p:foobar', 'v');
+ assert_equals(serialize(root), '<root xmlns:p="uri1"><child xmlns:ns1="uri2" ns1:foobar="v"/></root>');
+}, 'Check if attribute serialization takes into account of the same prefix declared in an ancestor element');
+
+test(function() {
+ assert_equals(serialize(parse('<root><child/></root>')), '<root><child/></root>');
+ assert_equals(serialize(parse('<root xmlns="u1"><p:child xmlns:p="u1"/></root>')), '<root xmlns="u1"><child xmlns:p="u1"/></root>');
+}, 'Check if start tag serialization drops element prefix if the namespace is same as inherited default namespace.');
+
+test(function() {
+ const root = parse('<root xmlns:p1="u1"><child xmlns:p2="u1"/></root>');
+ const child2 = root.ownerDocument.createElementNS('u1', 'child2');
+ root.firstChild.appendChild(child2);
+ assert_equals(serialize(root), '<root xmlns:p1="u1"><child xmlns:p2="u1"><p2:child2/></child></root>');
+}, 'Check if start tag serialization finds an appropriate prefix.');
+
+test(function() {
+ const root = (new Document()).createElementNS('uri1', 'p:root');
+ root.setAttributeNS(XMLNS_URI, 'xmlns:p', 'uri2');
+ assert_equals(serialize(root), '<ns1:root xmlns:ns1="uri1" xmlns:p="uri2"/>');
+}, 'Check if start tag serialization takes into account of its xmlns:* attributes');
+
+test(function() {
+ const root = (new Document()).createElement('root');
+ root.setAttributeNS(XMLNS_URI, 'xmlns:p', 'uri2');
+ const child = root.ownerDocument.createElementNS('uri1', 'p:child');
+ root.appendChild(child);
+ assert_equals(serialize(root), '<root xmlns:p="uri2"><p:child xmlns:p="uri1"/></root>');
+}, 'Check if start tag serialization applied the original prefix even if it is declared in an ancestor element.');
+
+test(function() {
+ const root = parse('<root><child1/><child2/></root>');
+ root.firstChild.setAttributeNS('uri1', 'attr1', 'value1');
+ root.firstChild.setAttributeNS('uri2', 'attr2', 'value2');
+ root.lastChild.setAttributeNS('uri3', 'attr3', 'value3');
+ assert_equals(serialize(root), '<root><child1 xmlns:ns1="uri1" ns1:attr1="value1" xmlns:ns2="uri2" ns2:attr2="value2"/><child2 xmlns:ns3="uri3" ns3:attr3="value3"/></root>');
+}, 'Check if generated prefixes match to "ns${index}".');
+
+test(function() {
+ const root = parse('<root xmlns:ns2="uri2"><child xmlns:ns1="uri1"/></root>');
+ root.firstChild.setAttributeNS('uri3', 'attr1', 'value1');
+ // According to 'DOM Parsing and Serialization' draft as of 2018-12-11,
+ // 'generate a prefix' result can conflict with an existing xmlns:ns* declaration.
+ assert_equals(serialize(root), '<root xmlns:ns2="uri2"><child xmlns:ns1="uri1" xmlns:ns1="uri3" ns1:attr1="value1"/></root>');
+}, 'Check if "ns1" is generated even if the element already has xmlns:ns1.');
+
+test(function() {
+ const root = (new Document()).createElement('root');
+ root.setAttributeNS('http://www.w3.org/1999/xlink', 'href', 'v');
+ assert_equals(serialize(root), '<root xmlns:ns1="http://www.w3.org/1999/xlink" ns1:href=""
+
+ const root2 = (new Document()).createElement('root');
+ root2.setAttributeNS('http://www.w3.org/1999/xlink', 'xl:type', 'v');
+ assert_equals(serialize(root2), '<root xmlns:xl="http://www.w3.org/1999/xlink" xl:type="v"/>');
+}, 'Check if no special handling for XLink namespace unlike HTML serializer.');
+
+</script>
</body>
</html>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-xhtml.xhtml (243812 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-xhtml.xhtml 2019-04-03 17:45:17 UTC (rev 243812)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-xhtml.xhtml 2019-04-03 17:48:31 UTC (rev 243813)
@@ -1,8 +1,8 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>insertAdjacentHTML in HTML</title>
- <script src=""
- <script src=""
+ <script src=""
+ <script src=""
<script src=""
</head>
<body>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any-expected.txt (0 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any-expected.txt 2019-04-03 17:48:31 UTC (rev 243813)
@@ -0,0 +1,38 @@
+
+PASS idl_test setup
+PASS Partial interface Element: original interface defined
+PASS Partial interface Range: original interface defined
+PASS DOMParser interface: existence and properties of interface object
+PASS DOMParser interface object length
+PASS DOMParser interface object name
+PASS DOMParser interface: existence and properties of interface prototype object
+PASS DOMParser interface: existence and properties of interface prototype object's "constructor" property
+PASS DOMParser interface: existence and properties of interface prototype object's @@unscopables property
+PASS DOMParser interface: operation parseFromString(DOMString, SupportedType)
+PASS DOMParser must be primary interface of new DOMParser()
+PASS Stringification of new DOMParser()
+PASS DOMParser interface: new DOMParser() must inherit property "parseFromString(DOMString, SupportedType)" with the proper type
+PASS DOMParser interface: calling parseFromString(DOMString, SupportedType) on new DOMParser() with too few arguments must throw TypeError
+PASS XMLSerializer interface: existence and properties of interface object
+PASS XMLSerializer interface object length
+PASS XMLSerializer interface object name
+PASS XMLSerializer interface: existence and properties of interface prototype object
+PASS XMLSerializer interface: existence and properties of interface prototype object's "constructor" property
+PASS XMLSerializer interface: existence and properties of interface prototype object's @@unscopables property
+PASS XMLSerializer interface: operation serializeToString(Node)
+PASS XMLSerializer must be primary interface of new XMLSerializer()
+PASS Stringification of new XMLSerializer()
+PASS XMLSerializer interface: new XMLSerializer() must inherit property "serializeToString(Node)" with the proper type
+PASS XMLSerializer interface: calling serializeToString(Node) on new XMLSerializer() with too few arguments must throw TypeError
+PASS ShadowRoot interface: attribute innerHTML
+PASS Element interface: attribute outerHTML
+PASS Element interface: operation insertAdjacentHTML(DOMString, DOMString)
+PASS Element interface: attribute innerHTML
+PASS Element interface: document.createElement("div") must inherit property "outerHTML" with the proper type
+PASS Element interface: document.createElement("div") must inherit property "insertAdjacentHTML(DOMString, DOMString)" with the proper type
+PASS Element interface: calling insertAdjacentHTML(DOMString, DOMString) on document.createElement("div") with too few arguments must throw TypeError
+PASS Element interface: document.createElement("div") must inherit property "innerHTML" with the proper type
+PASS Range interface: operation createContextualFragment(DOMString)
+PASS Range interface: new Range() must inherit property "createContextualFragment(DOMString)" with the proper type
+PASS Range interface: calling createContextualFragment(DOMString) on new Range() with too few arguments must throw TypeError
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any.html (0 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any.html 2019-04-03 17:48:31 UTC (rev 243813)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any.js (0 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any.js (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any.js 2019-04-03 17:48:31 UTC (rev 243813)
@@ -0,0 +1,19 @@
+// META: script=/resources/WebIDLParser.js
+// META: script=/resources/idlharness.js
+
+'use strict';
+
+// https://w3c.github.io/DOM-Parsing/
+
+idl_test(
+ ['DOM-Parsing'],
+ ['dom'],
+ idlArray => {
+ idlArray.add_objects({
+ DOMParser: ['new DOMParser()'],
+ Element: ['document.createElement("div")'],
+ Range: ['new Range()'],
+ XMLSerializer: ['new XMLSerializer()'],
+ })
+ }
+);
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any.worker-expected.txt (0 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any.worker-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any.worker-expected.txt 2019-04-03 17:48:31 UTC (rev 243813)
@@ -0,0 +1,27 @@
+
+PASS idl_test setup
+PASS Partial interface Element: original interface defined
+PASS Partial interface Range: original interface defined
+PASS DOMParser interface: existence and properties of interface object
+FAIL DOMParser must be primary interface of new DOMParser() assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: DOMParser"
+FAIL Stringification of new DOMParser() assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: DOMParser"
+FAIL DOMParser interface: new DOMParser() must not have property "parseFromString" assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: DOMParser"
+PASS XMLSerializer interface: existence and properties of interface object
+FAIL XMLSerializer must be primary interface of new XMLSerializer() assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: XMLSerializer"
+FAIL Stringification of new XMLSerializer() assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: XMLSerializer"
+FAIL XMLSerializer interface: new XMLSerializer() must not have property "serializeToString" assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: XMLSerializer"
+PASS Node interface: existence and properties of interface object
+PASS Document interface: existence and properties of interface object
+PASS DocumentType interface: existence and properties of interface object
+PASS DocumentFragment interface: existence and properties of interface object
+PASS ShadowRoot interface: existence and properties of interface object
+PASS Element interface: existence and properties of interface object
+FAIL Element interface: document.createElement("div") must not have property "outerHTML" assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: document"
+FAIL Element interface: document.createElement("div") must not have property "insertAdjacentHTML" assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: document"
+FAIL Element interface: document.createElement("div") must not have property "innerHTML" assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: document"
+PASS CharacterData interface: existence and properties of interface object
+PASS Text interface: existence and properties of interface object
+PASS AbstractRange interface: existence and properties of interface object
+PASS Range interface: existence and properties of interface object
+FAIL Range interface: new Range() must not have property "createContextualFragment" assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: Range"
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any.worker.html (0 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any.worker.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/interfaces.any.worker.html 2019-04-03 17:48:31 UTC (rev 243813)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/style_attribute_html.html (243812 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/style_attribute_html.html 2019-04-03 17:45:17 UTC (rev 243812)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/style_attribute_html.html 2019-04-03 17:48:31 UTC (rev 243813)
@@ -1,8 +1,8 @@
<!doctype html>
<meta charset=utf-8>
<title>Style attribute in HTML</title>
-<script src=""
-<script src=""
+<script src=""
+<script src=""
<script>
var div;
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/w3c-import.log (243812 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/w3c-import.log 2019-04-03 17:45:17 UTC (rev 243812)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/w3c-import.log 2019-04-03 17:48:31 UTC (rev 243813)
@@ -1,7 +1,7 @@
The tests in this directory were imported from the W3C repository.
Do NOT modify these tests directly in WebKit.
Instead, create a pull request on the WPT github:
- https://github.com/w3c/web-platform-tests
+ https://github.com/web-platform-tests/wpt
Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
@@ -15,8 +15,12 @@
------------------------------------------------------------------------
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-internal-subset.html
-/LayoutTests/imported/w3c/web-platform-tests/domparsing/OWNERS
+/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror.html
+/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml.html
+/LayoutTests/imported/w3c/web-platform-tests/domparsing/META.yml
+/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
@@ -26,8 +30,12 @@
/LayoutTests/imported/w3c/web-platform-tests/domparsing/innerhtml-07.html
/LayoutTests/imported/w3c/web-platform-tests/domparsing/innerhtml-mxss.sub.html
/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert-adjacent.html
+/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-xhtml.xhtml
/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/interfaces.any.js
/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
+/LayoutTests/imported/w3c/web-platform-tests/domparsing/xmldomparser.html
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/xmldomparser-expected.txt (0 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/xmldomparser-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/xmldomparser-expected.txt 2019-04-03 17:48:31 UTC (rev 243813)
@@ -0,0 +1,3 @@
+
+FAIL XML Dom Parse readyState Test assert_equals: expected "complete" but got "interactive"
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/xmldomparser.html (0 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/xmldomparser.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/xmldomparser.html 2019-04-03 17:48:31 UTC (rev 243813)
@@ -0,0 +1,13 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>XML Dom Parse readyState Test</title>
+<script src=""
+<script src=""
+<script>
+ test(function () {
+ assert_equals(
+ (new DOMParser()).parseFromString("<html></html>", "text/xml").readyState,
+ "complete"
+ );
+ });
+</script>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/interfaces/DOM-Parsing.idl (0 => 243813)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/interfaces/DOM-Parsing.idl (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/interfaces/DOM-Parsing.idl 2019-04-03 17:48:31 UTC (rev 243813)
@@ -0,0 +1,39 @@
+// GENERATED CONTENT - DO NOT EDIT
+// Content was automatically extracted by Reffy into reffy-reports
+// (https://github.com/tidoust/reffy-reports)
+// Source: DOM Parsing and Serialization (https://w3c.github.io/DOM-Parsing/)
+
+[Constructor, Exposed=Window]
+interface DOMParser {
+ [NewObject] Document parseFromString(DOMString str, SupportedType type);
+};
+
+enum SupportedType {
+ "text/html",
+ "text/xml",
+ "application/xml",
+ "application/xhtml+xml",
+ "image/svg+xml"
+};
+
+[Constructor, Exposed=Window]
+
+interface XMLSerializer {
+ DOMString serializeToString(Node root);
+};
+
+interface mixin InnerHTML {
+ [CEReactions, TreatNullAs=EmptyString] attribute DOMString innerHTML;
+};
+
+Element includes InnerHTML;
+ShadowRoot includes InnerHTML;
+
+partial interface Element {
+ [CEReactions, TreatNullAs=EmptyString] attribute DOMString outerHTML;
+ [CEReactions] void insertAdjacentHTML(DOMString position, DOMString text);
+};
+
+partial interface Range {
+ [CEReactions, NewObject] DocumentFragment createContextualFragment(DOMString fragment);
+};