diff --git a/core/includes/common.inc b/core/includes/common.inc index 0b95dcd..7f1a0b2 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -3967,6 +3967,9 @@ function drupal_region_class($region) { * - browsers: An array containing information specifying which browsers * should load the JavaScript item. See * drupal_pre_render_conditional_comments() for details. + * - attributes: An associative array of custom additional attributes for the + * rendered HTML element. Note that attributes resulting of other specified + * options cannot be overridden. * * @return * The current array of JavaScript files, settings, and in-line code, @@ -4286,6 +4289,11 @@ function drupal_pre_render_scripts($elements) { } } + // Apply custom HTML element attributes, if any have been specified. + if (!empty($item['attributes'])) { + $element['#attributes'] += $item['attributes']; + } + $elements[] = $element; } }