Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOMContentLoaded does not fire in LiveSample #10766

Closed
debiru opened this issue Dec 22, 2023 · 5 comments · Fixed by #10770 or #10946
Closed

DOMContentLoaded does not fire in LiveSample #10766

debiru opened this issue Dec 22, 2023 · 5 comments · Fixed by #10770 or #10946
Labels
🐛 bug Something isn't working, or isn't working as expected needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. p2 We want to address this but may have other higher priority items. plus:playground

Comments

@debiru
Copy link

debiru commented Dec 22, 2023

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Document/readystatechange_event

What specific section or headline is this issue about?

The play function

What information was incorrect, unhelpful, or incomplete?

https://developer.mozilla.org/en-US/docs/web/api/document/readystatechange_event#result says "load" only.

What did you expect to see?

The result says:

DOMContentLoaded
readystate: complete
load

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

I think this issue should be addressed in the yari repository. Sorry if this has already been reported.

MDN metadata

Page report details
@debiru debiru added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Dec 22, 2023
@Kaiido
Copy link

Kaiido commented Jan 15, 2024

The same code sample can also be seen in https://pr31723.content.dev.mdn.mozit.cloud/en-US/docs/Web/API/Document/DOMContentLoaded_event, and https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event.
https://developer.mozilla.org/en-US/docs/Web/API/touch_events, and https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Looping_code are also affected (mdn/content#31288 is caused by this).
The issue seems to be that the JS content is actually inserted after the page load, and while a synthetic load event is manually fired, there is nothing for the other events that should have fired too, and all the properties that should denote a loading document in general will be wrong.

While mdn/content#31288 could be fixed easily by not waiting for that event anymore, it seems indeed problematic that the feature as a whole can't handle these cases properly.

@bsmth bsmth transferred this issue from mdn/content Mar 22, 2024
@bsmth
Copy link
Member

bsmth commented Mar 22, 2024

Thanks a lot to both of you for reporting and investigating 🙏🏻 I've moved this over to Yari which I think is the right place for it!

@caugner caugner added 🐛 bug Something isn't working, or isn't working as expected p2 We want to address this but may have other higher priority items. plus:playground labels Mar 22, 2024
@wbamberg
Copy link
Collaborator

@caugner, this does not seem to be fixed by #10770 .

@wbamberg wbamberg reopened this Apr 16, 2024
@caugner

This comment was marked as outdated.

@caugner caugner closed this as completed Apr 16, 2024
@Kaiido
Copy link

Kaiido commented Apr 16, 2024

@caugner the initial report links to a section that still reproduces the original issue. Your playground isn't listening for the event in the same way.
To fix it and other related issues, you'd need to fire the DOMContentLoaded event from the document (and to make it bubble) and to also fire a readystate event.

This issue has not been fixed yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working, or isn't working as expected needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. p2 We want to address this but may have other higher priority items. plus:playground
Projects
None yet
5 participants