Commit 249d026
fix(common): execute checks and remove placeholder when image is already 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 #554441 parent 1391928 commit 249d026
File tree
1 file changed
+30
-4
lines changed- packages/common/src/directives/ng_optimized_image
1 file changed
+30
-4
lines changedLines changed: 30 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
695 | 695 | | |
696 | 696 | | |
697 | 697 | | |
| 698 | + | |
| 699 | + | |
698 | 700 | | |
699 | 701 | | |
700 | 702 | | |
| |||
1012 | 1014 | | |
1013 | 1015 | | |
1014 | 1016 | | |
1015 | | - | |
| 1017 | + | |
1016 | 1018 | | |
1017 | 1019 | | |
1018 | 1020 | | |
| |||
1105 | 1107 | | |
1106 | 1108 | | |
1107 | 1109 | | |
1108 | | - | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
1109 | 1113 | | |
1110 | 1114 | | |
1111 | 1115 | | |
| |||
1115 | 1119 | | |
1116 | 1120 | | |
1117 | 1121 | | |
| 1122 | + | |
| 1123 | + | |
1118 | 1124 | | |
1119 | 1125 | | |
1120 | 1126 | | |
| |||
1160 | 1166 | | |
1161 | 1167 | | |
1162 | 1168 | | |
1163 | | - | |
| 1169 | + | |
1164 | 1170 | | |
1165 | 1171 | | |
1166 | 1172 | | |
| |||
1176 | 1182 | | |
1177 | 1183 | | |
1178 | 1184 | | |
1179 | | - | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
1180 | 1188 | | |
1181 | 1189 | | |
1182 | 1190 | | |
1183 | 1191 | | |
1184 | 1192 | | |
1185 | 1193 | | |
| 1194 | + | |
| 1195 | + | |
1186 | 1196 | | |
1187 | 1197 | | |
1188 | 1198 | | |
| |||
1325 | 1335 | | |
1326 | 1336 | | |
1327 | 1337 | | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
1328 | 1354 | | |
1329 | 1355 | | |
1330 | 1356 | | |
| |||
0 commit comments