Bug 15436

Summary: Wrong proximity positions for XPath reverse axes
Product: WebKit Reporter: nanto_vi (TOYAMA Nao) <nanto>
Component: XMLAssignee: Alexey Proskuryakov <ap>
Status: RESOLVED FIXED    
Severity: Normal CC: ap
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: All   
OS: All   
URL: http://amachang.art-code.org/xpath_functional_test/
Bug Depends on:    
Bug Blocks: 15448    
Attachments:
Description Flags
test case (for fast/xpath)
none
proposed fix andersca: review+

nanto_vi (TOYAMA Nao)
Reported 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: <ul> <li id="li1">foo</li> <li id="li2">bar</li> <li id="li3">baz</li> </ul> <script type="text/javascript"> alert(document.evaluate('preceding-sibling::*[1]', document.getElementById('li3'), null, 8, null) .singleNodeValue.id); </script> 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
Attachments
test case (for fast/xpath) (1.26 KB, text/html)
2007-10-09 09:59 PDT, Alexey Proskuryakov
no flags
proposed fix (7.19 KB, patch)
2007-10-09 11:15 PDT, Alexey Proskuryakov
andersca: review+
Alexey Proskuryakov
Comment 1 2007-10-09 09:59:07 PDT
Created attachment 16597 [details] test case (for fast/xpath)
Alexey Proskuryakov
Comment 2 2007-10-09 11:15:55 PDT
Created attachment 16598 [details] proposed fix
Anders Carlsson
Comment 3 2007-10-09 12:16:16 PDT
Comment on attachment 16598 [details] proposed fix r=me
Alexey Proskuryakov
Comment 4 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...
Note You need to log in before you can comment on or make changes to this bug.