RESOLVED FIXED Bug 15989
XPath queries with predicates incorrectly retains the current node across unions
https://bugs.webkit.org/show_bug.cgi?id=15989
Summary XPath queries with predicates incorrectly retains the current node across unions
Khoo Yit Phang
Reported 2007-11-14 12:41:07 PST
In the nightlies as well as Safari 3.0.3 on Tiger, XPath queries which contain unions of queries with predicates (e.g. "ancestor::xhtml:*[local-name()='span']|.") doesn't quite work right. It seems that the context-node gets overwritten by each union operand predicate, so every subsequent operand is applied to the wrong context node. E.g.: <div> <span id="A"> <span id="B"/> </span> </div> The query "ancestor::xhtml:*[local-name()='span']|." from span#B will not return [span#A, span#B] since the context-node for both operands are span#B. It will instead return [span#A, div], as if the context-node for the second operand had been the top-most ancestor.
Attachments
Test case in XHTML and inline Javascript. (2.53 KB, application/xhtml+xml)
2007-11-14 12:42 PST, Khoo Yit Phang
no flags
proposed fix (8.25 KB, patch)
2007-11-15 12:28 PST, Alexey Proskuryakov
darin: review+
Khoo Yit Phang
Comment 1 2007-11-14 12:42:19 PST
Created attachment 17276 [details] Test case in XHTML and inline Javascript.
Alexey Proskuryakov
Comment 2 2007-11-15 12:28:09 PST
Created attachment 17300 [details] proposed fix This makes me think that we might need to import another large XPath test suite. Unfortunately, the only ones I know are XSLT-based, and would require a lot of work to adapt. I've tried to think of other places where we need to restore the context, but I don't see any.
Darin Adler
Comment 3 2007-11-15 13:29:41 PST
Comment on attachment 17300 [details] proposed fix r=me \ No newline at end of file Can we fix that?
Alexey Proskuryakov
Comment 4 2007-11-15 22:04:59 PST
Committed revision 27837.
Note You need to log in before you can comment on or make changes to this bug.