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

fix(common): execute checks when image is already loaded #55444

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arturovt
Copy link
Contributor

With this commit, we're now able to perform checks even when the image has already been loaded (e.g., from the browser cache), and its load event would never be triggered. We utilize the complete property, as specified, which indicates that the image state is fully available when the user agent has retrieved all the image data. This approach effectively triggers checks, as we no longer solely rely on the load event and consider that the image may already be loaded. Additionally, it helps prevent memory leaks in development mode, as load and error event listeners will still be attached to the image element.

@arturovt arturovt force-pushed the fix/ng-optimize-complete-state branch 3 times, most recently from 8edc403 to 0d687eb Compare April 20, 2024 22:19
With this commit, we're now able to perform checks even when the image has already
been loaded (e.g., from the browser cache), and its `load` event would never be triggered.
We utilize the [complete](https://html.spec.whatwg.org/#dom-img-complete) property, as specified,
which indicates that the image state is fully available when the user agent has retrieved all
the image data. This approach effectively triggers checks, as we no longer solely rely on the
`load` event and consider that the image may already be loaded. Additionally, it helps prevent
memory leaks in development mode, as `load` and `error` event listeners will still be attached
to the image element.
@arturovt arturovt force-pushed the fix/ng-optimize-complete-state branch from 0d687eb to b224ebd Compare April 20, 2024 23:20
@arturovt arturovt marked this pull request as ready for review April 22, 2024 16:05
@pullapprove pullapprove bot requested a review from dylhunn April 22, 2024 16:05
@AndrewKushnir AndrewKushnir requested review from kara and AndrewKushnir and removed request for dylhunn April 22, 2024 22:33
@AndrewKushnir AndrewKushnir added action: review The PR is still awaiting reviews from at least one requested reviewer area: common Issues related to APIs in the @angular/common package target: patch This PR is targeted for the next patch release common: image directive labels Apr 22, 2024
@ngbot ngbot bot added this to the Backlog milestone Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: review The PR is still awaiting reviews from at least one requested reviewer area: common Issues related to APIs in the @angular/common package common: image directive target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants