Commit 5b34ece
committed
RSCImage: default lazy images to sizes="auto" for optimal srcset selection
Apply sizes="auto, 100vw" to both the <source> elements and the <img> when no
explicit sizes is provided and the image is lazy (non-priority). Per the HTML
spec a <source sizes="auto"> only engages when its sibling <img> also "allows
auto-sizes" (loading="lazy" + sizes starting with "auto"), so it must be set on
the <img> too. Lets the browser pick the best candidate from the rendered
width; degrades to 100vw on browsers without auto support. Verified in Chrome.1 parent 596e989 commit 5b34ece
1 file changed
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
62 | 77 | | |
63 | 78 | | |
64 | 79 | | |
| |||
99 | 114 | | |
100 | 115 | | |
101 | 116 | | |
| 117 | + | |
102 | 118 | | |
103 | 119 | | |
104 | 120 | | |
| |||
0 commit comments