Title: [160024] trunk
- Revision
- 160024
- Author
- rn...@webkit.org
- Date
- 2013-12-03 11:44:55 -0800 (Tue, 03 Dec 2013)
Log Message
XML fragment parsing algorithm doesn't use the context element's default namespace URI
https://bugs.webkit.org/show_bug.cgi?id=125132
Reviewed by Darin Adler.
Source/WebCore:
Always use the context element's namespace as the default namespace URI when one is not specified by xmlns.
The new behavior matches that of Internet Explorer and the specified behavior in HTML5:
http://www.w3.org/TR/2013/CR-html5-20130806/the-xhtml-syntax.html#parsing-xhtml-fragments
"The default namespace is the namespace for which the DOM isDefaultNamespace() method on the element would
return true."
Test: fast/parser/fragment-parsing-in-document-without-xmlns.html
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::XMLDocumentParser):
LayoutTests:
Added a test for parsing a markup fragment inside a XHTML document without xmlns.
The parsed fragment should use the context element's namespace as the default namespace.
* fast/parser/fragment-parsing-in-document-without-xmlns-expected.txt: Added.
* fast/parser/fragment-parsing-in-document-without-xmlns.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (160023 => 160024)
--- trunk/LayoutTests/ChangeLog 2013-12-03 19:43:25 UTC (rev 160023)
+++ trunk/LayoutTests/ChangeLog 2013-12-03 19:44:55 UTC (rev 160024)
@@ -1,3 +1,16 @@
+2013-12-03 Ryosuke Niwa <rn...@webkit.org>
+
+ XML fragment parsing algorithm doesn't use the context element's default namespace URI
+ https://bugs.webkit.org/show_bug.cgi?id=125132
+
+ Reviewed by Darin Adler.
+
+ Added a test for parsing a markup fragment inside a XHTML document without xmlns.
+ The parsed fragment should use the context element's namespace as the default namespace.
+
+ * fast/parser/fragment-parsing-in-document-without-xmlns-expected.txt: Added.
+ * fast/parser/fragment-parsing-in-document-without-xmlns.html: Added.
+
2013-12-03 Radu Stavila <stav...@adobe.com>
The overflow border of a relatively positioned element inside a region is not painted
Added: trunk/LayoutTests/fast/parser/fragment-parsing-in-document-without-xmlns-expected.txt (0 => 160024)
--- trunk/LayoutTests/fast/parser/fragment-parsing-in-document-without-xmlns-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/parser/fragment-parsing-in-document-without-xmlns-expected.txt 2013-12-03 19:44:55 UTC (rev 160024)
@@ -0,0 +1,12 @@
+This tests the fragment parsing algorithm inside a XHTML document without xmlns set on the document element via innerHTML. The element without prefix or xmlns attribute should use the default namespace of the context element (that of body element in this case).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+xmlDocumentWithoutXmlns.body = xmlDocumentWithoutXmlns.createElement('body');
+contextElement = xmlDocumentWithoutXmlns.body;
+FAIL contextElement.innerHTML = '<a href="" contextElement.body.firstChild.namespaceURI should be http://www.w3.org/1999/xhtml. Threw exception TypeError: undefined is not an object (evaluating 'contextElement.body.firstChild')
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/parser/fragment-parsing-in-document-without-xmlns.html (0 => 160024)
--- trunk/LayoutTests/fast/parser/fragment-parsing-in-document-without-xmlns.html (rev 0)
+++ trunk/LayoutTests/fast/parser/fragment-parsing-in-document-without-xmlns.html 2013-12-03 19:44:55 UTC (rev 160024)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+
+description("This tests the fragment parsing algorithm inside a XHTML document without xmlns set on the document element via innerHTML.\n"
+ + "The element without prefix or xmlns attribute should use the default namespace of the context element (that of body element in this case).");
+
+var xhtmlDoctype = document.implementation.createDocumentType('html',
+ '-//W3C//DTD XHTML 1.0 Strict//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
+var xmlDocumentWithoutXmlns = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', xhtmlDoctype);
+evalAndLog("xmlDocumentWithoutXmlns.body = xmlDocumentWithoutXmlns.createElement('body');");
+evalAndLog("contextElement = xmlDocumentWithoutXmlns.body;");
+shouldBe("contextElement.innerHTML = '<a href="" contextElement.body.firstChild.namespaceURI", "'http://www.w3.org/1999/xhtml'");
+
+var successfullyParsed = true;
+
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (160023 => 160024)
--- trunk/Source/WebCore/ChangeLog 2013-12-03 19:43:25 UTC (rev 160023)
+++ trunk/Source/WebCore/ChangeLog 2013-12-03 19:44:55 UTC (rev 160024)
@@ -1,3 +1,23 @@
+2013-12-03 Ryosuke Niwa <rn...@webkit.org>
+
+ XML fragment parsing algorithm doesn't use the context element's default namespace URI
+ https://bugs.webkit.org/show_bug.cgi?id=125132
+
+ Reviewed by Darin Adler.
+
+ Always use the context element's namespace as the default namespace URI when one is not specified by xmlns.
+
+ The new behavior matches that of Internet Explorer and the specified behavior in HTML5:
+ http://www.w3.org/TR/2013/CR-html5-20130806/the-xhtml-syntax.html#parsing-xhtml-fragments
+
+ "The default namespace is the namespace for which the DOM isDefaultNamespace() method on the element would
+ return true."
+
+ Test: fast/parser/fragment-parsing-in-document-without-xmlns.html
+
+ * xml/parser/XMLDocumentParserLibxml2.cpp:
+ (WebCore::XMLDocumentParser::XMLDocumentParser):
+
2013-12-03 Nick Diego Yamane <nick.yam...@openbossa.org>
Remove some CSS Variables leftovers
Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp (160023 => 160024)
--- trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp 2013-12-03 19:43:25 UTC (rev 160023)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp 2013-12-03 19:44:55 UTC (rev 160024)
@@ -627,6 +627,7 @@
if (elemStack.isEmpty())
return;
+ // FIXME: Share code with isDefaultNamespace() per http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#parsing-xhtml-fragments
for (; !elemStack.isEmpty(); elemStack.removeLast()) {
Element* element = elemStack.last();
if (element->hasAttributes()) {
@@ -640,8 +641,7 @@
}
}
- // If the parent element is not in document tree, there may be no xmlns attribute; just default to the parent's namespace.
- if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument())
+ if (m_defaultNamespaceURI.isNull())
m_defaultNamespaceURI = parentElement->namespaceURI();
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes