Bug 15437 - XPath substring-after function is broken
Summary: XPath substring-after function is broken
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:50 PDT by nanto_vi (TOYAMA Nao)
Modified: 2007-10-09 12:09 PDT (History)
0 users

See Also:

proposed fix (7.38 KB, patch)
2007-10-09 09:31 PDT, Alexey Proskuryakov
mitz: 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:50:10 PDT
The substring-after function returns a substring begining at <length of search string>, instead of <length of search string> + <found index>.

alert(document.evaluate("substring-after('abcde', 'd')",
document, null, XPathResult.STRING_TYPE, null).stringValue);

"e" in Gecko and Opera, "bcde" in WebKit.  This is revealed in amachang's XPath test (see the URL field).
Comment 1 Alexey Proskuryakov 2007-10-09 09:31:34 PDT
Created attachment 16595 [details]
proposed fix
Comment 2 mitz 2007-10-09 09:39:03 PDT
Comment on attachment 16595 [details]
proposed fix

Comment 3 Alexey Proskuryakov 2007-10-09 12:09:37 PDT
Committed revision 26173 (feature branch).