Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

srcset description for <source> element is incorrect and misleading. #22820

Closed
romainmenke opened this issue Dec 8, 2022 · 0 comments · Fixed by #24420
Closed

srcset description for <source> element is incorrect and misleading. #22820

romainmenke opened this issue Dec 8, 2022 · 0 comments · Fixed by #24420
Labels
Content:HTML Hypertext Markup Language docs help wanted If you know something about this topic, we would love your help!

Comments

@romainmenke
Copy link
Contributor

MDN URL

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source

What specific section or headline is this issue about?

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source#attr-srcset

What information was incorrect, unhelpful, or incomplete?

A list of one or more strings, separated by commas, indicating a set of possible images represented by the source for the browser to use. Each string is composed of:

  • One URL specifying an image.
  • A width descriptor, which consists of a string containing a positive integer directly followed by "w", such as 300w. The default value, if missing, is the infinity.
  • A pixel density descriptor, that is a positive floating number directly followed by "x". The default value, if missing, is 1x.

Each string in the list must have at least a width descriptor or a pixel density descriptor to be valid. Among the list, there must be only one string containing the same tuple of width descriptor and pixel density descriptor. The browser chooses the most adequate image to display at a given point of time. If width descriptors are used, the sizes attribute must also be present, or the srcset value will be ignored.

This reads as if this would be valid :

<picture>
  <source srcset="
    mdn-logo-wide.png 400w 1x,
    mdn-logo-wide-2x.png 400w 2x,
    mdn-logo-extra-wide.png 800w 1x,
    mdn-logo-extra-wide-2x.png 800w 2x
  " media="(min-width: 800px)" />

  <img src="mdn-logo-narrow.png" alt="MDN Web Docs" />
</picture>

What did you expect to see?

Documentation that matches the specification : https://html.spec.whatwg.org/multipage/images.html#image-candidate-string

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
@github-actions github-actions bot added Content:HTML Hypertext Markup Language docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Dec 8, 2022
@sideshowbarker sideshowbarker added help wanted If you know something about this topic, we would love your help! and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Dec 16, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Content:HTML Hypertext Markup Language docs help wanted If you know something about this topic, we would love your help!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants