June 24, 2008
document.createExpression change between Firefox 2 and Firefox 3
Ran into this with an IBM product I am working on:
In Firefox 3 (Gecko 1.9), there seems to have been a change that affects XPath and document.createExpression. In particular, you now have to call createExpression on the document you will run the XPath against. Before, you could call createExpression on another document.
In Firefox 2, the following would work:
var expr = document.createExpression(...);
In Firefox 3, you will get:
Node cannot be used in a document other than the one in which it was created" code: "4
Example showing this: http://nexgenmedia.net/mozilla/playgroundxpath.html
Hopefully this will save people time when running into this.
Posted by doron at June 24, 2008 9:34 AM
TrackBack URL for this entry:
Listed below are links to weblogs that reference document.createExpression change between Firefox 2 and Firefox 3:
Tracked on April 23, 2009 2:49 PM
Tracked on May 9, 2009 2:08 AM
Tracked on July 22, 2009 4:42 PM
Tracked on July 23, 2009 5:10 AM
Posted by: Mark Finkle at June 24, 2008 6:25 PM
Thanks for the info,
that also means, that document.evaluate have to be run onto the right element. Since my getElementsByClassName supports the native one, that wasnt a problem for Firefox 3. But maybe some day other browsers behaivoir change in a way like Firefox does, but doesnt support native getElementsByClassName.
But that that now alos covered by my function: http://phpfi.com/327120
Posted by: Fabian at June 28, 2008 10:28 AM
Fantastic! I've been looking around for a solution, luckily for me you posted it! :D
Posted by: Tom at January 23, 2009 11:50 AM