Bug 5576
Summary: | XPath query fails with "is not object" | ||
---|---|---|---|
Product: | WebKit | Reporter: | Michiel Roding <michiel> |
Component: | XML | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | ||
Priority: | P2 | ||
Version: | 420+ | ||
Hardware: | Mac | ||
OS: | OS X 10.4 | ||
Bug Depends on: | |||
Bug Blocks: | 10489 |
Michiel Roding
I've been trying to use XPath in both the nightly Safari and the stable release; and it just won't work; any
clearity on how to use, if usable, XPath in Webkit would be appreciated.
A sample document; which works in Firefox and Camino;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Safari XPath test</title>
<style>
.bla { border: 1px solid red;}
</style>
</head>
<body>
<dl>
<dt>lorem</dt>
<dd>ipsum</dd>
<dd>another one</dd>
<dt>next</dt>
<dd>follow-up</dd>
</dl>
<script>
var iterator = document.evaluate("/html/body", document, null, 0, null);
while(item = iterator.iterateNext())
{
item.className = 'bla';
}
</script>
</body>
</html>
No matter what XPath query I used (I was trying //dl/dt[1]/following-sibling::dd[1]) - always get the
error:
TypeError: value undefined (result of expression document.evaluate) is not object.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Paul Everitt
I asked in IRC and found out that XPath evaluation isn't claimed to work. IIRC, it also isn't
on the near-term radar either.
That's too bad, as I could really use this facility.
Joost de Valk (AlthA)
Confirmed on request of Paul Everitt.
Eric Seidel (no email)
Folks on the KDE side, in the library KDOM (which stems from a very similar code base to WebCore)
already have two working xpath implementations. One for 1.0 and a partial one for 2.0. It's possible that
someone could port one of these into WebCore with relatively minimal effort.
Jesse Costello-Good
I am evaluating Safari for a port of TIBCO(R) General Interface, a mature AJAX platform that is currently IE
only. Fixing this bug would make the port more feasible.
Anders Carlsson
*** This bug has been marked as a duplicate of 6638 ***