Firefox扩展与jQuery 1.3 + [英] Firefox extension with jquery 1.3+
问题描述
$ mb = jQuery.noConflict();
var doc = window.content.document
$ mb(body,doc).slideToggle(slow);
我知道在这个页面,但这也行不通。
那么有没有人在这里使用比扩展的jquery-1.2.6更新的版本,并可以告诉我怎么样?
我为我的问题找到了一个解决方案!
我会在这里介绍它,以便其他人可以使用它作为参考。经过大量的搜索和撕裂我的头发,我发现了这个错误报告的jquery bug跟踪。你可以在那里下载 jquery 1.3.1 Revision:6161 修复了这个问题(官方的1.3.1版本是修订版:6158)。
另外一个很好的技巧就是在firefox扩展中包含类似jquery的on the fly 。只要在你的扩展中的一些JavaScript文件中包含以下内容:
var jsLoader = Components.classes [@ mozilla.org/moz /jssubscript-loader;1\"].getService(Components.interfaces.mozIJSSubScriptLoader);
jsLoader.loadSubScript(chrome:// {appname} /content/jquery-1.3.1_6161.js);
jQuery.noConflict();
//使用jquery
var doc = window.content.document;
alert(jQuery(body,doc).html());
更新:今天版本1.3.2发布了,问题似乎解决了!
I use jquery-1.2.6 within my Firefox extensions and it works great. Some days ago i wanted to update to the current version of jquery (1.31) but this does not seem to work anymore. Here is my technique to include jquery in my extensions:
$mb = jQuery.noConflict();
var doc = window.content.document
$mb("body", doc).slideToggle("slow");
I am aware of the technique described at this page, but that does not work either. So is there anybody here that uses a newer version than jquery-1.2.6 in Firefox extensions and can tell me how?
i found a solution for my problem!
I will present it here so that others can use this as a reference. After a lot of searching and tearing my hair i found this bug report on the jquery bug tracker. You can download jquery 1.3.1 Revision: 6161 there which fixes the problem (the official 1.3.1 release is Revision: 6158).
Another great trick a found out is including library's like jquery "on the fly" in firefox extensions. Just include the following within some javascript file within your extension:
var jsLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
jsLoader.loadSubScript("chrome://{appname}/content/jquery-1.3.1_6161.js");
jQuery.noConflict();
//use jquery
var doc = window.content.document;
alert(jQuery("body", doc).html());
Update: Today version 1.3.2 was released and the problem seems to be solved!
这篇关于Firefox扩展与jQuery 1.3 +的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!