mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9.25k stars 22.49k forks source link

HTMLImageElement.srcset: sizes attribute doesn't need to be present #27291

Open panino opened 1 year ago

panino commented 1 year ago

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset

What specific section or headline is this issue about?

https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset#sect1

What information was incorrect, unhelpful, or incomplete?

(Machine-translated)

On the HTMLImageElement page: srcset property - Web APIs | MDN, it is mentioned that if the srcset attribute uses width (w) descriptors, the sizes attribute must also be present, or the srcset itself will be ignored. However, according to the WHATWG HTML Standard specification, if the sizes attribute is not present, its default value is 100vw. This means that if the sizes attribute is not defined, the browser will assume that the image will always be displayed in the full width of the viewport and will select the most appropriate image from the srcset based on that assumption.

Please update the documentation to reflect this information correctly.

Thank you.

Original En la página [HTMLImageElement: srcset property - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset), se menciona que si el atributo srcset usa descriptores de ancho (w), el atributo sizes también debe estar presente, o el srcset en sí mismo será ignorado. Sin embargo, según la especificación de WHATWG [HTML Standard](https://html.spec.whatwg.org/multipage/images.html#srcset-attribute), si el atributo sizes no está presente, su valor predeterminado es 100vw. Esto significa que si no se define el atributo sizes, el navegador asumirá que la imagen siempre se mostrará en el ancho completo del viewport y seleccionará la imagen más adecuada del srcset en función de esa suposición. Por favor, actualicen la documentación para reflejar esta información correctamente. Gracias.

What did you expect to see?

I hope they remove the mentioned quote or correct it.

Original Espero que eliminen la cita mencionada o que la corrijan.

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details * Folder: `en-us/web/api/htmlimageelement/srcset` * MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset * GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/api/htmlimageelement/srcset/index.md * Last commit: https://github.com/mdn/content/commit/a3d9f61a8990ba7b53bda9748d1f26a9e9810b18 * Document last modified: 2023-04-07T00:39:15.000Z
bsmth commented 1 year ago

Apologies for moving the issue around, I thought the problem was about es locale translated content.