Skip to content

Commit

Permalink
[Fiber] use srcset to trigger load even on img mount
Browse files Browse the repository at this point in the history
In facebook#23316 we fixed a bug where onload events were missed if they happened too early. This update adds support for srcset to retrigger the load event. Firefox unfortunately does not trigger a load even when you assign srcset so this won't work in every browser when you use srcset without src however it does close a gap in chrome at least
  • Loading branch information
gnoff committed Jul 16, 2024
1 parent 0117239 commit 72fc28d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,8 @@ export function commitMount(
case 'img': {
if ((newProps: any).src) {
((domElement: any): HTMLImageElement).src = (newProps: any).src;
} else if ((newProps: any).srcSet) {
((domElement: any): HTMLImageElement).srcset = (newProps: any).srcSet;
}
return;
}
Expand Down

0 comments on commit 72fc28d

Please sign in to comment.