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
Force JS execution after page/DOM fully loads #4189
Force JS execution after page/DOM fully loads #4189
Conversation
@bokeh/dev This seems a reasonable and straightforward solution to the problem in the linked issue, but maybe there are other considerations or approaches, comments appreciated. |
This seems either unnecessary or misplaced, but I need to give this some thought. |
In any case, this shouldn't use |
For context it appears that at least on some browsers, the script executes
before the DOM is done loading. This cause the code that looks up its own
script tag to fail. Maybe we accidentally go away with something for a
while, but it seems true that the script needs to execute only after the
DOM loads. So I think we have to do something to ensure that. Agreed
`addEventListener` is probably better, I forgot about that.
Sean, here is a reference for that:
http://www.w3schools.com/jsref/event_onload.asp
|
Cool. I found (and tested) another solution using document.addEventListener("DOMContentLoaded", function(event) { //DOM is loaded and ready //Run Bokeh anonymous function here }); Bryan, you'll have to guide me through what to do next. Do I simply create a new branch again but with the new fix and submit a PR again? Should I wait for more comments before solving the problem multiple different ways? |
@seanlaw No, GH is really nice in this regard. If you just add/commit the new changes to this branch on your local checkout, and then push again, this PR will be automatically updated. |
Also FYI the one test failure is spurious and unrelated. |
Made the new change. See if that works or is better? Note that I indented the existing anonymous function and so it might look like I made a lot of changes but they are only formatting changes. |
@seanlaw Thanks! Yah I noticed the annoying diff, but I can see it is just the small change. GH diffs are usually fairly good but sometimes they can appear messy under some circumstances. ping @birdsarah @havocp @mattpap comments on this? |
Verbal conversation with @birdsarah, we can't think of any reasons not to pursue this approach. @mattpap if you still have concerns please open another issue to discuss them. I will merge this went Travis turns green. Thanks for the contribution @seanlaw ! |
As a last check I built the docs and inspected the gallery, which uses |
Amazing! Thanks for pushing it through. I'm guessing this makes me an intro-level bokeh contributor rather than a bokeh developer? :) |
Unfortunately I think this broke notebook support (I was not aware that notebook |
All pull requests must have an associated issue in the issue tracker. If there
isn't one, please go open an issue describing the defect, deficiency or desired
feature. You can read more about our issue and PR processes in the
wiki.