1/** 2 * @file 3 * Parse inline JSON and initialize the drupalSettings global object. 4 */ 5 6(function () { 7 // Use direct child elements to harden against XSS exploits when CSP is on. 8 const settingsElement = document.querySelector( 9 'head > script[type="application/json"][data-drupal-selector="drupal-settings-json"], body > script[type="application/json"][data-drupal-selector="drupal-settings-json"]', 10 ); 11 12 /** 13 * Variable generated by Drupal with all the configuration created from PHP. 14 * 15 * @global 16 * 17 * @type {object} 18 */ 19 window.drupalSettings = {}; 20 21 if (settingsElement !== null) { 22 window.drupalSettings = JSON.parse(settingsElement.textContent); 23 } 24})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.