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.
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.
Confirmed on request of Paul Everitt.
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.
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.
*** This bug has been marked as a duplicate of 6638 ***