If the js in the site is aggregated then the ajax load module will load "all" the module again instead of loading just the unloaded module.

Is this the default way for ajax load? is there anyway to avoid this?

thanks

CommentFileSizeAuthor
#2 ajax_load.png12.37 KBduckzland

Comments

markus_petrux’s picture

Status: Active » Postponed (maintainer needs more info)

It works here. I do not recall if the fix is included in latest version, or it is just in the -dev tarball.

duckzland’s picture

StatusFileSize
new12.37 KB

Tried the dev version today and the result still the same.

I've attached a firebug screenshot that re-loads the supposed to be aggregated js (example the admin.menu.js) on ajax call.

I'm using javascript aggregator module on top on the drupal standard aggregator.

webkenny’s picture

Version: 6.x-1.3 » 6.x-1.x-dev
Component: Miscellaneous » Code
Category: support » bug
Priority: Normal » Major
Status: Postponed (maintainer needs more info) » Active

We can confirm this with CSS as well. The offending code is:

// Test if the stylesheet already exists.
if (!$('link[href*=' + src + ']').size()) {
  $('<link type="text/css" rel="stylesheet" media="' + media + '" href="' + src + '" />').appendTo('head');
}

Lines 69-72 of ajax_load.js - As you can see, it is checking to see if a link tag exists for a given style sheet and then adds it if not. Obviously in the case of CSS aggregation, most sheets won't exist via link unless you have explicitly placed them there outside of the normal Drupal way (e.g. a link tag in the tpl)

In some instances this causes entire layouts to break since the stylesheets are loaded after the aggregated CSS file therefore overriding what is set in the theme. Specifically we've noticed problems with the .nested class of fusion_core.

Note our example only uses the default Drupal aggregation found on the Performance page.

webkenny’s picture

Title: Doesn't Honour Aggregated JS » Ajax Load does not honor Aggregated JS or CSS files

Adjusting the title.

markus_petrux’s picture

Status: Active » Postponed (maintainer needs more info)

Those lines do not exist in the latest code in CVS. See:

http://drupalcode.org/viewvc/drupal/contributions/modules/ajax_load/ajax...

Please, try latest dev version. It uses a different method to check if a particular stylesheet exists.

Related issue: #685918: Drupal.theme functions implemented by other modules are broken when javascript compression is enabled

webkenny’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

You're right. Sorry about that. Marking as duplicate.