Jetpack PageMods incompatibility with jQuery effects functions



8 years ago
8 years ago


(Reporter: watinha, Unassigned)


Firefox Tracking Flags

(Not tracked)



(1 attachment)



8 years ago
User-Agent:       Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b7) Gecko/20100101 Firefox/4.0b7
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; pt-BR; rv: Gecko/20101026 Firefox/3.6.12

I am not sure why but all effects function that I try inside the pageMod are not executed in webpages. The query functions of jQuery run fine, my only concern is related to the effects functions.

Next I describe the code I used for implementing the pageMods. Basically I only call a function to load javascript code from my data folder of my package.

var page_mod = require("page-mod");
var data = require("self").data;

page_mod.add(new page_mod.PageMod({
  include: ["file:///*"],
  contentScriptURL: [data.url("jquery.js"), data.url("touch-interaction.js")],
  contentScriptWhen: "ready"

At first I though it was related to the timing functions, since I noted that the setTimeout function does not accept string parameters when executed as a pagemod. However I checked that jquery library only implements setTimeout routines with functions parameters, just as supported by pagemods.

Just to emphasize that the code runs perfectly when included locally on a webpage. I also experimented including the javascript libraries by using the jetpack tabs functionality (tab.contentDocument, etc.) and the javascript worked properly.

Reproducible: Always

Steps to Reproduce:
1. Load jQuery library through pageMods
2. Try execute any of the effects functionality in jQuery through pageMods as well (fadeOut, fadeIn, slideDown, slideUp and animate).
Actual Results:  
The animation expected from the effects functions are not visualized and the elements CSS are not changed as they should be.

Expected Results:  
It is expected that the animations are rendered within the browser and observed in the DOM CSS.

I was using the Jetpack SDK 0.9. The problem does not generate any error message in the Jetpack console.
Created attachment 521231 [details]
Test case of jquery in content script of a page mod

Now, it seems to be working with current jQuery version (1.5.1) and last 1.4 version (1.4.4).

Willian: Can you confirm that your code is now working fine ?
Resolving fixed, but Willian: please reopen if you're still having problems!
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.