Bug 15380 - XPath: id('foo') doesn't resolve correctly
Summary: XPath: id('foo') doesn't resolve correctly
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: 523.x (Safari 3)
Hardware: All All
: P2 Normal
Assignee: Alexey Proskuryakov
Depends on:
Reported: 2007-10-05 13:44 PDT by Dan Fabulich
Modified: 2007-10-15 23:58 PDT (History)
1 user (show)

See Also:

example repro (1.15 KB, text/html)
2007-10-05 13:45 PDT, Dan Fabulich
no flags Details
proposed fix (4.82 KB, patch)
2007-10-06 03:21 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 Dan Fabulich 2007-10-05 13:44:45 PDT
Calling document.evaluate with "id('foo')" doesn't return an element, even when there's an HTML element with ID "foo" in the page.

To repro, open the attached xpathbug.html in WebKit nightly, Firefox 2.0, and Opera 9.2.

In Firefox and Opera, the test passes as the xpath resolves correctly; in WebKit (and Safari 3 Public Beta) the test fails as document.evaluate returns null.
Comment 1 Dan Fabulich 2007-10-05 13:45:20 PDT
Created attachment 16552 [details]
example repro
Comment 2 Alexey Proskuryakov 2007-10-05 23:30:46 PDT
And I thought I fixed this in bug 12485 :-/
Comment 3 Alexey Proskuryakov 2007-10-06 01:22:49 PDT
To work around this problem, append a space to the parameter: "id('nested1 ')" works fine to find an element with id "nested1".

> And I thought I fixed this in bug 12485 :-/

That was a completely different bug with similar symptoms. 
Comment 4 Alexey Proskuryakov 2007-10-06 03:21:57 PDT
Created attachment 16565 [details]
proposed fix
Comment 5 mitz 2007-10-06 03:32:49 PDT
Comment on attachment 16565 [details]
proposed fix

Comment 6 Alexey Proskuryakov 2007-10-06 04:10:16 PDT
Committed revision 26081 (feature branch).
Comment 7 Dan Fabulich 2007-10-11 11:46:44 PDT
This isn't yet fixed in the official webkit nightly builds (r26359), but I think that's expected, since the change is currently only in the feature-branch...?  How/when would we expect to see this in the nightly build?  [I won't even ask about when we'd expect to see this fixed in Safari ... ;-)]
Comment 8 Alexey Proskuryakov 2007-10-11 12:09:48 PDT
There are nightly builds of the feature branch - the link is hidden at the bottom of <http://nightly.webkit.org/>.

Also, as it was recently announced on the developer list, the feature branch will soon move to trunk.
Comment 9 Dan Fabulich 2007-10-15 15:08:17 PDT
This is fixed in WebKit trunk r26595.

Is this bug likely to get fixed in Safari 3?  Seed 310A15 is from September 26 and has this bug (which I filed on 10/5).
Comment 10 Alexey Proskuryakov 2007-10-15 23:58:45 PDT
(In reply to comment #9)
> Is this bug likely to get fixed in Safari 3?

Apple doesn't comment on future products, and we outside Apple do not have any information about their plans.