Closed Andrew-Cottrell closed 4 years ago
https://github.com/adobe/aem-core-wcm-components/blob/core.wcm.components.reactor-2.7.0/content/src/content/jcr_root/apps/core/wcm/components/accordion/v1/accordion/clientlibs/site/js/accordion.js#L510
if (document.readyState !== "loading") { onDocumentReady(); } else { document.addEventListener("DOMContentLoaded", onDocumentReady()); }
When document.readyState === "loading" the onDocumentReady function is executed immediately, before the DOMContentLoaded event is fired. A reference to the onDocumentReady function should be passed to document.addEventListener, not the return value.
document.readyState === "loading"
onDocumentReady
DOMContentLoaded
document.addEventListener
Thanks very much @Andrew-Cottrell for spotting this!
The code for this issue is merged to master and will be available in the upcoming 2.8.0 release.
https://github.com/adobe/aem-core-wcm-components/blob/core.wcm.components.reactor-2.7.0/content/src/content/jcr_root/apps/core/wcm/components/accordion/v1/accordion/clientlibs/site/js/accordion.js#L510
When
document.readyState === "loading"
theonDocumentReady
function is executed immediately, before theDOMContentLoaded
event is fired. A reference to theonDocumentReady
function should be passed todocument.addEventListener
, not the return value.