Question

I have old userscripts with jQuery that work fine in Firefox 16, but stopped working with the Firefox 17 release.

So, I was using version 16.0.2 until today when I tried to upgrade to 18 and the same problem persists. First, I thought that could be Greasemonkey and tried 1.6 version and the Scriptish add-on without success. So I tried to update jQuery version and no solution. It's not one script it's all of them with any jQuery code. Also no errors on console is reported.

Anybody does know what's going on?

Some errors reported by firebug console:

o.attachEvent("on"+e, h);

from:

window.addListener=function(o, e, h){
try{
o.attachEvent("on"+e, h);
}catch(a){
o.addEventListener(e, h, false);
}
} 

Another error on another script

GM_addStyle ( (<><![CDATA[

from:

GM_addStyle ( (<><![CDATA[
    #dtl {
        position:           absolute;
        top:                0;
        right:              0;      
    }
    #dtl iframe {
        width:              950;
        height:             680;
        border:             none;
    }

]]></>).toString () );
Was it helpful?

Solution

jQuery and Greasemonkey work fine in Firefox 17 and 18 (as long as you keep the sandbox active); that is not the problem.

The only major thing that changed with FF 17, that affected a lot of Greasemonkey scripts, is that Firefox dropped support for E4X.

With E4X, we could use CDATA to great effect making robust, multiline strings, like so:

GM_addStyle ( (<><![CDATA[
    #someNodeID {
        position:           fixed;
        top:                0;
        right:              0;
    }
]]></>).toString () );


But, now that E4X is no longer supported, we must refactor every bit of code that used CDATA, to using the javascript string escape (\), like so:

GM_addStyle ( '                         \
    #someNodeID {                       \
        position:           fixed;      \
        top:                0;          \
        right:              0;          \
    }                                   \
' );


When using that escape, you must pay extra attention to how you mix ' and " quotes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top