Active
Project:
Popups API (Ajax Dialogs) [D7]
Version:
6.x-2.0-alpha5
Component:
Code
Priority:
Minor
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Jan 2010 at 17:11 UTC
Updated:
5 Apr 2010 at 20:47 UTC
people often report problems related to dynamically adding css/js files to ajax-popups while css/js optimization is enabled in drupal performance settings. Maybe the use of ajax_load could help solving this issues?
Comments
Comment #1
sandfurz commentedi digged a little deeper into that issue:
The popup-content (fetched as JSON-object) contains a script-array, representing the js-files required by the new content within the popup. That array is compared against the scripts included by the current page - by using jquery-selector $('script[src]') - so that only the new files will be loaded.
If there is no javascript aggregation enabled, this works perfectly well!
Once you enable javascript optimization (admin/settings/performance => optimize javscript), there is only ONE js file included on the page, so $('script[src]') won't find *those* scripts, that have originally been aggregated into that file.
Now, loading new ajax-content, the complete js will be included again, even if it's already present within the aggregate-file, sometimes resulting in weird browser-crashes due to recursion.
Maybe we could store all original js-paths into a js-variable (using a module_page_preprocess?), so we can compare against *this* var instead of using $('script[src]')?
I don't know if it's feasable, but that would probably be a great improvement. Maybe i'll check this out, once there's some spare time :-)
Comment #2
sandfurz commentedmy solution:
=> http://drupal.org/node/436094#comment-2809334