http://bugs.webkit.org/show_bug.cgi?id=12560
W3C XPath test Text_Nodes.svg fails
WebCore:
* xml/XPathStep.cpp:
(WebCore::XPath::Step::nodeTestMatches): Revert the fix, as the behavior doesn't appear
all that desirable as it did at first glance.
LayoutTests:
* dom/svg/level3/xpath/Text_Nodes-expected.txt: This fails again.
* fast/xpath/4XPath/Borrowed/kd_20010423-expected.txt:
* fast/xpath/4XPath/Borrowed/kd_20010423.html:
Brought the test back to its original form (in which Firefox passes).
* fast/xpath/text-nodes-expected.txt: Added.
* fast/xpath/text-nodes.html: Added.
A new test for text nodes, verifying some more arcane cases.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@20110
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
* fast/events/content-changed-during-drop-expected.txt: Added.
* fast/events/content-changed-during-drop.html: Added.
+2007-03-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Adele.
+
+ http://bugs.webkit.org/show_bug.cgi?id=12560
+ W3C XPath test Text_Nodes.svg fails
+
+ * dom/svg/level3/xpath/Text_Nodes-expected.txt: This fails again.
+
+ * fast/xpath/4XPath/Borrowed/kd_20010423-expected.txt:
+ * fast/xpath/4XPath/Borrowed/kd_20010423.html:
+ Brought the test back to its original form (in which Firefox passes).
+
+ * fast/xpath/text-nodes-expected.txt: Added.
+ * fast/xpath/text-nodes.html: Added.
+ A new test for text nodes, verifying some more arcane cases.
+
2007-03-11 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
-Text_Nodes: Success
+Text_Nodes
+S1.2.4-Text-Nodes-Adjacent-Next: assertTrue failed
-PASS actual is "abcabca"
+PASS actual is "abcabcabc"
PASS successfullyParsed is true
TEST COMPLETE
while (currNode = nodeset.iterateNext())
actual += currNode.nodeValue;
- // In the original 4Suite test, the expectation was "abcabcabc". I believe it was wrong.
- shouldBe('actual', '"abcabca"')
+ // According to DOM XPath working group note, this should be "abcabca", but we'll rather match Firefox.
+ // See <http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#TextNodes>.
+ shouldBe('actual', '"abcabcabc"')
var successfullyParsed = true;
--- /dev/null
+<doc><elem>a<![CDATA[b]]>c</elem></doc>
+child::*, [object Element]: ""
+child::node(), [object Element]: "a b c"
+descendant::*, [object Element]: ""
+descendant::node(), [object Element]: "a b c"
+descendant::node()[2], [object Element]: "b"
+ancestor-or-self::node(), b: "b null null null"
+ancestor-or-self::*, b: "null null"
+ancestor-or-self::node(), a: "a null null null"
+ancestor-or-self::*, a: "null null"
+following::node(), [object Element]: ""
+following::node(), a: "b c"
+following::text(), a: "b c"
+following::node(), b: "c"
+following-sibling::node(), [object Element]: ""
+following-sibling::node(), a: "b c"
+following-sibling::text(), a: "b c"
+following-sibling::node(), b: "c"
+preceding::node(), b: "a"
+preceding-sibling::node(), b: "a"
+preceding::node(), c: "b a"
+preceding::text(), c: "b a"
+preceding-sibling::node(), c: "b a"
+preceding-sibling::text(), c: "b a"
+self::node(), b: "b"
+
--- /dev/null
+<body>
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ src = '<doc><elem>a<![CDATA[b]]>c</elem></doc>';
+ doc = (new DOMParser).parseFromString(src, "application/xml");
+
+ elem = doc.documentElement.firstChild;
+ aText = elem.firstChild;
+ bText = elem.firstChild.nextSibling;
+ cText = elem.lastChild;
+
+ function test(expr, context) {
+ nodeset = doc.evaluate(expr, context, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
+ str = "";
+ while (currNode = nodeset.iterateNext()) {
+ if (str)
+ str += " ";
+ str += currNode.nodeValue;
+ }
+
+ document.write(expr + ", " + (context.nodeValue ? context.nodeValue : context) + ": \"" + str + "\"<br>");
+ }
+
+ document.write("<xmp>" + src + "</xmp>");
+
+ test("child::*", elem);
+ test("child::node()", elem);
+ test("descendant::*", elem);
+ test("descendant::node()", elem);
+ test("descendant::node()[2]", elem);
+ test("ancestor-or-self::node()", bText); // the order of result nodes is incorrect in this test
+ test("ancestor-or-self::*", bText);
+ test("ancestor-or-self::node()", aText); // the order of result nodes is incorrect in this test
+ test("ancestor-or-self::*", aText);
+ test("following::node()", elem);
+ test("following::node()", aText);
+ test("following::text()", aText);
+ test("following::node()", bText);
+ test("following-sibling::node()", elem);
+ test("following-sibling::node()", aText);
+ test("following-sibling::text()", aText);
+ test("following-sibling::node()", bText);
+ test("preceding::node()", bText);
+ test("preceding-sibling::node()", bText);
+ test("preceding::node()", cText); // the order of result nodes is incorrect in this test
+ test("preceding::text()", cText); // the order of result nodes is incorrect in this test
+ test("preceding-sibling::node()", cText); // the order of result nodes is incorrect in this test
+ test("preceding-sibling::text()", cText); // the order of result nodes is incorrect in this test
+ test("self::node()", bText);
+
+ var successfullyParsed = true;
+
+</script>
+</body>
+2007-03-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Adele.
+
+ http://bugs.webkit.org/show_bug.cgi?id=12560
+ W3C XPath test Text_Nodes.svg fails
+
+ * xml/XPathStep.cpp:
+ (WebCore::XPath::Step::nodeTestMatches): Revert the fix, as the behavior doesn't appear
+ all that desirable as it did at first glance.
+
2007-03-11 Oliver Hunt <oliver@apple.com>
Reviewed by hyatt.
NodeVector matches;
switch (m_nodeTest.kind()) {
- case NodeTest::TextNodeTest: {
- HashSet<Node*> nodeSet;
+ case NodeTest::TextNodeTest:
for (unsigned i = 0; i < nodes.size(); i++) {
Node* node = nodes[i].get();
- if ((node->nodeType() == Node::TEXT_NODE || node->nodeType() == Node::CDATA_SECTION_NODE)) {
- nodeSet.add(node);
- if (!nodeSet.contains(node->previousSibling())) // See <http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#TextNodes>
- matches.append(node);
- }
+ if ((node->nodeType() == Node::TEXT_NODE || node->nodeType() == Node::CDATA_SECTION_NODE))
+ matches.append(node);
}
return matches;
- }
case NodeTest::CommentNodeTest:
for (unsigned i = 0; i < nodes.size(); i++) {
Node* node = nodes[i].get();