I am using jquery(ui as well) in my ff extension. All is working fine till ff 10.
var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
loader.loadSubScript("chrome://myext/content/js/jquery-1.7.2.js",wnd);
var jQ = wnd.jQuery.noConflict(true);
try {
loader.loadSubScript("chrome://myext/content/js/jquery.ui.core.min.js", jQ);
} catch (Except){
alert(Except.toString());
}
In FF 11 this code is not working. As per the above code, I am trying to load the jquery and then loading the jquery ui libs. Jquery is getting loaded but it doesn't load the "chrome://myext/content/js/jquery.ui.core.min.js" and give error "TypeError: a is undefined"
Any help would be appriciated.
I had a similar error, but putting loadSubScript in this position it worked for me:
//load jQuery
var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
loader.loadSubScript("chrome://myext/content/lib/jquery-1.7.2.js",context);
var jQuery = window.jQuery.noConflict(true);
if( typeof(jQuery.fn._init) == 'undefined') { jQuery.fn._init = jQuery.fn.init; }
var $ = function(selector,context){ return new jQuery.fn.init(selector,context||myext.doc); };
$.fn = $.prototype = jQuery.fn;
myext.jQuery = jQuery;
myext.$ = $;
loader.loadSubScript("chrome://myext/content/lib/jquery.tablesorter.js",jQuery);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With