diff --git a/core/misc/drupal.init.es6.js b/core/misc/drupal.init.es6.js index f8706db11a9b6be17125d73a15e375df70f862a0..686a062c9790fcd2d5305abbc8e1fdafb8d30c85 100644 --- a/core/misc/drupal.init.es6.js +++ b/core/misc/drupal.init.es6.js @@ -16,13 +16,13 @@ document.documentElement.className += ' js'; * The function to be called on document ready. */ const domReady = callback => { + const listener = () => { + callback(); + document.removeEventListener('DOMContentLoaded', listener); + }; if (document.readyState !== 'loading') { callback(); } else { - const listener = () => { - callback(); - document.removeEventListener('DOMContentLoaded', listener); - }; document.addEventListener('DOMContentLoaded', listener); } }; diff --git a/core/misc/drupal.init.js b/core/misc/drupal.init.js index 4e58fc5e56f99c55950f08c3f0171a780043742b..9b158bab3018bbe3bbd175dc35a4936b8077e847 100644 --- a/core/misc/drupal.init.js +++ b/core/misc/drupal.init.js @@ -13,14 +13,14 @@ document.documentElement.className += ' js'; (function (Drupal, drupalSettings) { var domReady = function domReady(callback) { + var listener = function listener() { + callback(); + document.removeEventListener('DOMContentLoaded', listener); + }; + if (document.readyState !== 'loading') { callback(); } else { - var listener = function listener() { - callback(); - document.removeEventListener('DOMContentLoaded', listener); - }; - document.addEventListener('DOMContentLoaded', listener); } };