-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
[BugFix] Image has already been loaded #389
[BugFix] Image has already been loaded #389
Conversation
Sometimes the image has already been loaded and it can't trigger the `onload` event. So we should check if the image has been loaded before binding the event, and if it has been loaded, we can call `setLoaded` directly. Otherwise, bind the `onload` event.
For https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/complete For https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/naturalHeight |
@zjhch123 Thank you for this contribution! I will look at it when I get time in the next day or two (it is a holiday here). |
1 similar comment
@zjhch123 Thank you for this contribution! I will look at it when I get time in the next day or two (it is a holiday here). |
This is still on my TO DO list. Thanks for the latest commit |
I'm extremely sorry for the delay here. I'm testing this now... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely change! Thank you for contributing. I'll publish this as a patch release and add you to the contributors!
This has been released in |
Thank you very much! |
Description
Sometimes the image has already been loaded and it can't trigger the
onload
event. So we should check if the image has been loaded before binding the event, and if it has been loaded, we can callsetLoaded
directly. Otherwise, bind theonload
event.Testing
Take the screenshot as an example:
Because
epid4.png
has already been loaded, so theonload
event doesn't be triggered as expected and the DOM showsdata-rmiz-content="not-found"
.After my change, it works!
Please let me know if any questions.
Thanks.