Loading jQuery UI in FF 11 gives an error :: "TypeError: a is undefined"

I am using jquery (ui also) in my ff extension. Everything works fine until 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 does not work. According to the code above, I am trying to load jquery and then load jquery ui libs. Jquery loads, but it does not load "chrome: //myext/content/js/jquery.ui.core.min.js" and gives the error "TypeError: a is undefined"

Any help would be assigned.

+6
source share
1 answer

I had a similar error, but when loading loadSubScript 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); 
+2
source

Source: https://habr.com/ru/post/911857/


All Articles