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

document.onload doesn't trigger with browser cache enabled #391

Open
clemos opened this issue Nov 28, 2013 · 3 comments
Open

document.onload doesn't trigger with browser cache enabled #391

clemos opened this issue Nov 28, 2013 · 3 comments

Comments

@clemos
Copy link
Contributor

clemos commented Nov 28, 2013

When browser cache is enabled (and thus, the loaded .html document is loaded from cache), Browser.document.addEventListener('load',foo) never triggers foo...

@yanhick
Copy link
Member

yanhick commented Nov 29, 2013

Ok, the load event is dispatched from here :
https://github.com/silexlabs/Cocktail/blob/master/cocktail/core/html/HTMLDocument.hx#LC591

Do you add the event listener before setting the document content ?

@clemos
Copy link
Contributor Author

clemos commented Nov 29, 2013

Yes, I'm still using Cocktail.boot( url ).

The problem is, before that, Browser.window is null so I just can't add the event listener
(It was Browser.window and not Browser.document BTW)

It seems actually impossible to access either window or document before loading the file,
so I guess if the file is loaded synchronously, the 'load' event cannot be used...

I guess both window and document should be created in the constructor, and never reinitialized...

What do you think ?

@yanhick
Copy link
Member

yanhick commented Nov 29, 2013

I couldn't see what's wrong by looking at cocktail's code. The samples also add the onload callback after calling "boot". I remember I fixed bugs similar to yours months ago, but I probably didn't fix everything.

If you can share a sample reproducing the bug, I can take a look this weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants