Steps to Reproduce:
Load foo-bar.js
foo-bar.js contains:
document.addEventListener('DOMContentLoaded', function() {
console.log('foo bar');
});
Expected Behavior:
console.log('foo bar') should run when the script executes.
Actual Behavior:
Because of how delayed JavaScript works, the DOMContentLoaded event doesn’t fire automatically. As a result, the callback never runs.
Suggested Solution:
Trigger the DOMContentLoaded event manually to ensure the JS code runs properly.