fix(common): execute checks and remove placeholder when image is already loaded - #55444
Closed
arturovt wants to merge 1 commit into
Closed
fix(common): execute checks and remove placeholder when image is already loaded#55444arturovt wants to merge 1 commit into
arturovt wants to merge 1 commit into
Conversation
arturovt
force-pushed
the
fix/ng-optimize-complete-state
branch
4 times, most recently
from
April 20, 2024 23:20
0d687eb to
b224ebd
Compare
arturovt
marked this pull request as ready for review
April 22, 2024 16:05
AndrewKushnir
requested review from
AndrewKushnir and
kara
and removed request for
dylhunn
April 22, 2024 22:33
…ady loaded 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 use 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. This will not remove the placeholder until the `load` event fires (and it won't fire if the image is already "there"). This prevents memory leaks in development mode, as `load` and `error` event listeners are still attached to the image element.
arturovt
force-pushed
the
fix/ng-optimize-complete-state
branch
from
September 18, 2024 16:04
b224ebd to
db5e8b3
Compare
Comment on lines
+1362
to
+1364
| if (img.complete && img.naturalWidth) { | ||
| callback(); | ||
| } |
Contributor
There was a problem hiding this comment.
@atcastle could you please help review this change when you get a chance?
atcastle
approved these changes
Sep 24, 2024
AndrewKushnir
approved these changes
Sep 24, 2024
Contributor
Member
|
This PR was merged into the repository by commit c3115b8. The changes were merged into the following branches: main, 18.2.x |
alxhub
pushed a commit
that referenced
this pull request
Sep 26, 2024
…ady loaded (#55444) 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 use 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. This will not remove the placeholder until the `load` event fires (and it won't fire if the image is already "there"). This prevents memory leaks in development mode, as `load` and `error` event listeners are still attached to the image element. PR Close #55444
This was referenced Oct 25, 2024
Open
This was referenced Oct 25, 2024
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
loadevent would never be triggered.We use 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
loadevent and consider that the image may already be loaded.This will not remove the placeholder until the
loadevent fires (and it won't fire if theimage is already "there").
This prevents memory leaks in development mode, as
loadanderrorevent listeners arestill attached to the image element.