When jQuery is loaded async, if all elements in a page are cached, it is possible that when jQuery is executed, the domready event has already fired, and Drupal.behaviors won't be executed.
We need mechanism to detect it and run Drupal.behaviors in that case. This bug exists only in D6 version, because it is fixed in jQuery 1.4+ which is used in D7.
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | labjs-advagg-1015978-20.patch | 4.35 KB | mikeytown2 |
| #18 | labjs-advagg-1015978-18.patch | 3.45 KB | mikeytown2 |
Comments
Comment #1
jcisio commentedComment #2
jcisio commentedThis is discussed at https://github.com/getify/LABjs/issues/16 and it affects both 6.x and 7.x branch. The fix could be quite easy: the jquery_update way! This module replaces drupal.js with its own version. I'll roll a patch in the next few days when I have time.
Comment #3
jcisio commentedIf anyone wants to test first:
- In this module change
$LAB.executeQueue();to- Then change your misc/drupal.js. In D7, replace this block (I removed comments)
with
This is untested, however.
Comment #4
bryancasler commentedcan't test tonight, will possibly give it a shot tomorrow evening
Comment #5
bryancasler commentedI could only find one instance of
$LAB.executeQueue();it was on line 88 of labjs.module'data' => LABJS_EXCLUDE . "\n\$LAB.executeQueue();",.After replacing that and updating drupal.js I went ahead and enabled LABjs. I received the following error.
After enabling I got "Parse error: syntax error, unexpected '(', expecting T_VARIABLE or '$' in C:\xampp\htdocs\drupal\sites\all\modules\labjs\labjs.module on line 88"
**I'm on D7**
Comment #6
jcisio commentedWe'll fix it in D7 first. I've committed a patch that does exactly what I said in #3. A small problem with overlay: when I click to a link, the hash change, new page is loaded by Ajax, but just right after that, the URL changes. This problem does not always happen, and I haven't found the cause.
Comment #7
jcisio commented#6 is separated into a new issue: #1050866: Intermittent problem with overlay.module. I consider it is fixed in 7.x. The rest is backporting to 6.x.
Comment #8
dgastudio commentedsubscribe
Comment #9
matthewdolman commentedI just installed the latest release and I get object not defined errors which leads me to believe that the $document(ready) is not firing in the included scripts.
Is this the same issue as mentioned here?
Comment #10
jcisio commentedNo, it is not the same thing. Please open new issue, with as much detail as possible.
Comment #11
mikeytown2 commentedusing advagg we can replace misc/drupal.js with a patched version of that file. I already do this when using jsmin+ as it blows up on the misc/jquery.form.js file.
http://drupalcode.org/project/advagg.git/blob/refs/heads/6.x-1.x:/advagg...
Comment #12
jcisio commentedYes, user with addavg enabled can profit pre alter to change drupal.js. Even without advagg, I think I can borrow from jquery_update.module to replace this file.
Comment #13
mikeytown2 commentedjcisio
Mind posting a modified drupal.js here and I'll fix this issue for users of advagg?
Comment #14
jcisio commentedThis a a diff for D7 drupal.js in #6. I haven't work in D6, but it should be the same.
You'll need to fire the scripts-ready event, too. It needs a patch for labjs.module. I'm really busy now, but I'll commit that code.
Comment #15
jcisio commentedOk, finally get it done. It's be more reasonable to fix LABjs issue in LABjs module ;)
Comment #16
mikeytown2 commentedSadly that last commit just broke advagg's integration with LABjs. JS file replacement has to happen though advagg's hooks because it does not use core's aggregation. If I write a patch for this module would you accept it?
Comment #17
jcisio commentedSure.
In this special case I think you'll patch LABjs so that if advagg is enabled, LABjs won't replace drupal.js, is it what you plan to do? Then in AdvAgg, use the drupal.modified.js instead ;)
Comment #18
mikeytown2 commentedLooks like my editor took care of some white space issues for you as well.
Comment #19
mikeytown2 commentedComment #20
mikeytown2 commentedstill learning git. Here's a patch on top of that one... well its all in one file. Forgot to rename the hook so its labjs
Comment #21
jcisio commentedI'm learning Git, too. Thanks for the patch. Reviewed, tested and committed. I'll let you close #1082612: LABjs compatibility .
Comment #23
socialnicheguru commentedThis is still an issue in D7 views 3 with labjs. I am using the dev version from 1-27-2012
Comment #24
jcisio commentedSocialNicheGuru, how to reproduce it? I tested with Views 3.1 with a few actions and I didn't have any problem.
Comment #25
iaugur commentedI get it with Views 7.x-3.3 - The collapsible groups fields don't work (in the popup for Display Suite settings). See #1237648: Accordion effects of the Overlay doesn't work in the views. for similar issue
It can be overcome with excluding the admin pages in Labjs configuration.
Comment #26
adamgerthel commentedI (think) I am having the same problem.
After activating Lab JS (tried latest release and latest dev), all javascript except $(document).ready stuff stops working. It doesn't seem to load at all. Firebug isn't showing any errors.
Comment #27
skein commentedViews Slideshow breaks for me if I enable LabJs. The view loads but no transition effects.
Comment #28
memoday commentedI am having the same issue here after 3-4 years from this post. Disabling labjs solved the issue. I don't even use advagg module. What is the real problem here and how should it be fixed?