diff --git a/includes/common.inc b/includes/common.inc index d259d0595b..0ad15cf86b 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -4484,14 +4484,14 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS switch ($item['type']) { case 'setting': $js_element = $element; - // The "drupal_settings_json" variable determines if drupal Settings - // should be displayed in JSON format, to allow for CSP - // (content security policy). This should be set to FALSE by default - // to allow BC. + // The "drupal_settings_json" variable determines if drupalSettings + // should be displayed in JSON format, to allow for CSP (content + // security policy). This should be set to FALSE by default to allow for + // backwards compatibility. if (variable_get('drupal_settings_json', FALSE)) { $js_element['#attributes'] = array( - // This type attribute prevents this from being parsed as an - // inline script. + // This type attribute prevents this from being parsed as an inline + // script. 'type' => 'application/json', 'data-drupal-selector' => 'drupal-settings-json', ); diff --git a/misc/drupal-settings-loader.js b/misc/drupal-settings-loader.js index dae2c2a988..dc6f343883 100644 --- a/misc/drupal-settings-loader.js +++ b/misc/drupal-settings-loader.js @@ -2,7 +2,9 @@ * @file * Parse inline JSON and initialize the drupal.settings global object. */ + (function ($) { + use strict; var settingsElement = document.querySelector('script[type="application/json"][data-drupal-selector="drupal-settings-json"]');