What is the issue with the HTML Standard?
When reading the current spec around <img sizes=auto>, it seems like both setting an image's display to none, as well as removing the image from the DOM, would trigger re-parsing of the sizes attribute and potentially triggering a fetch.
See https://gist.github.com/noamr/a201b894d0ac5ceea091874e72092023
- We have 5 images in a DIV with a
srcset and sizes, that are initially rendered in a size different from the default
- We then remove the DIV (or set it to
display:none)
- According to the spec (and current blink), those 5 images would trigger reloading, re-fire the
load event, etc.
Interestingly, Firefox does not exhibit this behavior (sizes=auto is not implemented in Safari).
This behavior seems extremely wasteful - if an image is removed/un-rendered, we should probably keep its currentSrc rather than switch it to the fallback, or at least not trigger a reload in that case.
See relevant chromium bug.
What is the issue with the HTML Standard?
When reading the current spec around
<img sizes=auto>, it seems like both setting an image'sdisplaytonone, as well as removing the image from the DOM, would trigger re-parsing of thesizesattribute and potentially triggering a fetch.See https://gist.github.com/noamr/a201b894d0ac5ceea091874e72092023
srcsetandsizes, that are initially rendered in a size different from the defaultdisplay:none)loadevent, etc.Interestingly, Firefox does not exhibit this behavior (sizes=auto is not implemented in Safari).
This behavior seems extremely wasteful - if an image is removed/un-rendered, we should probably keep its
currentSrcrather than switch it to the fallback, or at least not trigger a reload in that case.See relevant chromium bug.