views:

817

answers:

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?

+1  A: 

After window.content.document I don't see the semicolon, I think it's necessary.

tanathos
No, jquery-1.3+ does not work even with the semicolon. As I said, it works perfekt with jquery-1.2.6 (even without any semicolon). There must another problem...
bizzy
+3  A: 

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!

bizzy