Bug 15436 - Wrong proximity positions for XPath reverse axes
Summary: Wrong proximity positions for XPath reverse axes
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: 523.x (Safari 3)
Hardware: All All
: P2 Normal
Assignee: Alexey Proskuryakov
URL: http://amachang.art-code.org/xpath_fu...
Depends on:
Blocks: 15448
  Show dependency treegraph
Reported: 2007-10-09 07:30 PDT by nanto_vi (TOYAMA Nao)
Modified: 2007-10-09 12:24 PDT (History)
1 user (show)

See Also:

test case (for fast/xpath) (1.26 KB, text/html)
2007-10-09 09:59 PDT, Alexey Proskuryakov
no flags Details
proposed fix (7.19 KB, patch)
2007-10-09 11:15 PDT, Alexey Proskuryakov
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description nanto_vi (TOYAMA Nao) 2007-10-09 07:30:51 PDT
In XPath 1.0, the context position of a node in a node-set for a reverse axis is defined by reverse document order [1].  But WebKit uses document order for ancestor, ancestor-or-self, and preceding axes and arbitrary order for preceding axis.  Think the following code:

  <li id="li1">foo</li>
  <li id="li2">bar</li>
  <li id="li3">baz</li>
<script type="text/javascript">
                        document.getElementById('li3'), null, 8, null)

WebKit alerts "li1" while Gecko and Opera alerts "li2".  This is revealed by amachang's XPath test (see the URL field).

[1] http://www.w3.org/TR/1999/REC-xpath-19991116#predicates
Comment 1 Alexey Proskuryakov 2007-10-09 09:59:07 PDT
Created attachment 16597 [details]
test case (for fast/xpath)
Comment 2 Alexey Proskuryakov 2007-10-09 11:15:55 PDT
Created attachment 16598 [details]
proposed fix
Comment 3 Anders Carlsson 2007-10-09 12:16:16 PDT
Comment on attachment 16598 [details]
proposed fix

Comment 4 Alexey Proskuryakov 2007-10-09 12:24:59 PDT
Committed revision 26174 (feature branch).

It would be nice to include the whole test in our regression suite. I tried to find the author and sent an e-mail asking for permission, but I could have got it wrong...