在FF 11中加载jQuery UI会给出错误::“TypeError:a is undefined” [英] Loading jquery UI in FF 11 give error:: "TypeError: a is undefined"

查看:131
本文介绍了在FF 11中加载jQuery UI会给出错误::“TypeError:a is undefined”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的ff扩展中使用jquery(ui)。所有工作正常,直到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);
尝试{
loader.loadSubScript(chrome://myext/content/js/jquery.ui.core.min.js,jQ);
} catch(Except){
alert(Except.toString());

在FF 11中,这段代码不起作用。
根据上面的代码,我想加载jquery,然后加载jquery ui库。
Jquery正在被加载,但它不会加载chrome://myext/content/js/jquery.ui.core.min.js并给出错误TypeError:a is undefined



任何帮助将被appriciated。

解决方案

我有一个类似的错误,但是把loadSubScript放在这个位置对我很有用:

  // 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);


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);

这篇关于在FF 11中加载jQuery UI会给出错误::“TypeError:a is undefined”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆