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.
Created attachment 17276 [details] Test case in XHTML and inline Javascript.
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.
Comment on attachment 17300 [details] proposed fix r=me \ No newline at end of file Can we fix that?
Committed revision 27837.