Commit c3115b8
fix(common): execute checks and remove placeholder when image is already loaded (angular#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 angular#554441 parent 1549afe commit c3115b8
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 | |
|---|---|---|---|
| |||
708 | 708 | | |
709 | 709 | | |
710 | 710 | | |
| 711 | + | |
| 712 | + | |
711 | 713 | | |
712 | 714 | | |
713 | 715 | | |
| |||
1025 | 1027 | | |
1026 | 1028 | | |
1027 | 1029 | | |
1028 | | - | |
| 1030 | + | |
1029 | 1031 | | |
1030 | 1032 | | |
1031 | 1033 | | |
| |||
1118 | 1120 | | |
1119 | 1121 | | |
1120 | 1122 | | |
1121 | | - | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
1122 | 1126 | | |
1123 | 1127 | | |
1124 | 1128 | | |
| |||
1128 | 1132 | | |
1129 | 1133 | | |
1130 | 1134 | | |
| 1135 | + | |
| 1136 | + | |
1131 | 1137 | | |
1132 | 1138 | | |
1133 | 1139 | | |
| |||
1173 | 1179 | | |
1174 | 1180 | | |
1175 | 1181 | | |
1176 | | - | |
| 1182 | + | |
1177 | 1183 | | |
1178 | 1184 | | |
1179 | 1185 | | |
| |||
1189 | 1195 | | |
1190 | 1196 | | |
1191 | 1197 | | |
1192 | | - | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
1193 | 1201 | | |
1194 | 1202 | | |
1195 | 1203 | | |
1196 | 1204 | | |
1197 | 1205 | | |
1198 | 1206 | | |
| 1207 | + | |
| 1208 | + | |
1199 | 1209 | | |
1200 | 1210 | | |
1201 | 1211 | | |
| |||
1338 | 1348 | | |
1339 | 1349 | | |
1340 | 1350 | | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
1341 | 1367 | | |
1342 | 1368 | | |
1343 | 1369 | | |
| |||
0 commit comments