-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Listener executes after DOM is already loaded, widget doesn't mount
#79
Comments
Since we don't care about stylesheets and images, we want to render the widget as soon as the dependency scripts are available. So, we use the Only reason I can think of for it to not work is if the widget's script (index.js) is loaded as |
@bhch Thanks for your answer. The weird thing is that listening to the |
That's a great find! I just read some more about it and, indeed, It's hard to tell what's preventing it from bubbling in your case (possibly some other script is using |
@bhch Sounds good. Just submitted a PR. Thank you for your work on this library. |
Prevent widget initialization issues in case another script prevents the event from bubbling to the window object. Issue: #79 Co-authored-by: Martin Gouy <martin@heyartifact.com>
Fixed in #80. I will release a new version in a couple of days. |
Released the fix in v2.15.0. Please upgrade. Thank you for the bug report. |
Hello!
In our production environment, this listener executes after the DOM is already mounted, and thus, the widget doesn't mount:
https://github.com/bhch/django-jsonform/blob/bf968559d15e1e79e9be71fb121fec62dee8bdd1/django_jsonform/static/django_jsonform/index.js#LL2C35-L2C35
window.addEventListener('load'...
to get it workingTwo questions:
DOMContentLoaded
was added in this commit: eaf03c7 . Any objection to changing it toload
? Happy to open a PRThe text was updated successfully, but these errors were encountered: