SproutCore Is Crap | Main | Extensions and Firefox 3 - nsICookieService Behavior Change

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(...);
    expr.evaluate(anotherDocument, ...)

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 Pings

TrackBack URL for this entry:

Listed below are links to weblogs that reference document.createExpression change between Firefox 2 and Firefox 3:

Viagra hgh. from Generic viagra.
Women s viagra. Viagra. Generic viagra. Viagra for women. The new viagra. Viagra uk medix plus forum. [Read More]

Tracked on April 23, 2009 2:49 PM

Smoking codeine. from Codeine.
Codeine dextromethorphan. Codeine. Codeine withdrawal. Liquid codeine. [Read More]

Tracked on May 9, 2009 2:08 AM

Xanax. from Xanax.
Xanax bars. Symptoms of xanax use. Generic xanax. [Read More]

Tracked on July 22, 2009 4:42 PM

Lipitor lawsuit. from Lipitor.
Lipitor online. Lipitor dosage morning or night. Side effects of lipitor drugs. Lipitor. [Read More]

Tracked on July 23, 2009 5:10 AM


Docs updated:

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

Post a comment

Remember Me?