diff options
author | catch <catch@35733.no-reply.drupal.org> | 2022-09-09 07:26:42 +0100 |
---|---|---|
committer | catch <catch@35733.no-reply.drupal.org> | 2022-09-09 07:26:42 +0100 |
commit | 8aa8ce1ffbcca9c727f46e58c714e1d351f7ef88 (patch) | |
tree | 27be6908992c340ba0b4c0bd3f4339670aa71e90 /core/misc/drupal.init.js | |
parent | 09f8f13d8a72b8e482cc689fcd10f023df41b899 (diff) | |
download | drupal-8aa8ce1ffbcca9c727f46e58c714e1d351f7ef88.tar.gz drupal-8aa8ce1ffbcca9c727f46e58c714e1d351f7ef88.zip |
Issue #3278415 by nod_, lauriii, catch, Wim Leers, longwave, xjm, claudiu.cristea: Remove usages of the JavaScript ES6 build step, the build step itself, and associated dev dependencies
Diffstat (limited to 'core/misc/drupal.init.js')
-rw-r--r-- | core/misc/drupal.init.js | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/core/misc/drupal.init.js b/core/misc/drupal.init.js index be0cae2fcdd..c3d961550d5 100644 --- a/core/misc/drupal.init.js +++ b/core/misc/drupal.init.js @@ -1,23 +1,25 @@ -/** -* DO NOT EDIT THIS FILE. -* See the following change record for more information, -* https://www.drupal.org/node/2815083 -* @preserve -**/ - +// Allow other JavaScript libraries to use $. if (window.jQuery) { jQuery.noConflict(); } +// Class indicating that JS is enabled; used for styling purpose. document.documentElement.className += ' js'; +// JavaScript should be made compatible with libraries other than jQuery by +// wrapping it in an anonymous closure. (function (Drupal, drupalSettings) { - const domReady = callback => { + /** + * Calls callback when document ready. + * + * @param {function} callback + * The function to be called on document ready. + */ + const domReady = (callback) => { const listener = () => { callback(); document.removeEventListener('DOMContentLoaded', listener); }; - if (document.readyState !== 'loading') { setTimeout(callback, 0); } else { @@ -25,7 +27,8 @@ document.documentElement.className += ' js'; } }; + // Attach all behaviors. domReady(() => { Drupal.attachBehaviors(document, drupalSettings); }); -})(Drupal, window.drupalSettings);
\ No newline at end of file +})(Drupal, window.drupalSettings); |