summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc4
1 files changed, 4 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 348390e33..bc211bfeb 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -2793,6 +2793,10 @@ function drupal_add_js($data = NULL, $options = NULL) {
// Preprocess can only be set if caching is enabled.
$options['preprocess'] = $options['cache'] ? $options['preprocess'] : FALSE;
+ // Tweak the weight so that files of the same weight are included in the
+ // order of the calls to drupal_add_js().
+ $options['weight'] += count($javascript) / 1000;
+
if (isset($data)) {
// Add jquery.js and drupal.js, as well as the basePath setting, the
// first time a Javascript file is added.