Skip to content

Delayed JS doesn’t trigger DOMContentLoaded event #165

@mustafauysal

Description

@mustafauysal

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions