diff --git a/includes/scripts.inc b/includes/scripts.inc index 52d0672..38e0026 100644 --- a/includes/scripts.inc +++ b/includes/scripts.inc @@ -51,7 +51,7 @@ // otherwise, keep it in the header. // Done again here because scope may change on alter. foreach ($javascript as $js_key => $js_value) { - if ($js_value['force header']) { + if (isset($js_value['force header']) && $js_value['force header']) { $javascript[$js_key]['scope'] = 'header'; } else { @@ -439,6 +439,12 @@ function aurora_group_js($javascript) { 'IE' ); + // As these are not native in Drupal, we add in the default values. + $item += array( + 'defer' => FALSE, + 'async' => FALSE, + ); + // The browsers for which the JavaScript item needs to be loaded is part of // the information that determines when a new group is needed, but the order // of keys in the array doesn't matter, and we don't want a new group if all @@ -457,6 +463,7 @@ function aurora_group_js($javascript) { case 'external': case 'setting': case 'inline': + default: // Do not group external, settings, and inline items. $group_keys = FALSE; break; @@ -464,8 +471,9 @@ function aurora_group_js($javascript) { } // If the group keys don't match the most recent group we're working with, - // then a new group must be made. - if (!empty($group_keys) && $group_keys !== $current_group_keys) { + // then a new group must be made. Also, each inline, external, or setting + // script will also be in their own group. + if ((!empty($group_keys) && $group_keys !== $current_group_keys) || $group_keys == FALSE) { $index++; // Initialize the new group with the same properties as the first item // being placed into it. The item's 'data' and 'weight' properties are