Skip to content

Srcset implementations do not take width as a fallback when sizes is not present #5893

Closed

Description

@yoavweiss

While looking into #4968, I noticed that HTML's parsing a sizes attribute is taking the image element's width into account as the fallback, in case sizes is not present.
This used to make sense, before the changes made in WICG/intrinsicsize-attribute#16 (comment)
Since width no longer implies absolute pixel values, it no longer does, and I think we should remove that.

Looking at the different implementations (test page - needs to be tested on 1 DPR screen), none of them treats width as the fallback value, meaning we can easily remove that from the spec.

@zcorpan @annevk @chrishtr - thoughts?

Activity

  1. added
    topic: img
    on Sep 7, 2020
  2. zcorpan commented on Sep 7, 2020

    @zcorpan
    Member

    As far as I can tell, it's implemented in chromium/webkit/gecko. Compare with no width or sizes attribute, which defaults to 100vw.

  3. zcorpan commented on Sep 7, 2020

    @zcorpan
    Member

    This used to make sense, before the changes made in WICG/intrinsicsize-attribute#16 (comment)
    Since width no longer implies absolute pixel values, it no longer does, and I think we should remove that.

    I think that change doesn't influence much for this behavior. The width attribute could be overridden with CSS before just like now. It's also a fallback that is only used in invalid documents, since the sizes attribute is required when srcset uses w.

  4. zcorpan commented on Sep 7, 2020

    @zcorpan
    Member

    Hmm, wait. I was confused in my first comment. A clearer test is <img width=400 style="width: auto" ...>, where the intrinsic size from sizes is used for rendering, which is 100vw in chromium/webkit/gecko.

    OK, since it's not implemented, removing it seems fine.

  5. added
    removal/deprecation
    on Sep 9, 2020
  6. annevk commented on Sep 9, 2020

    @annevk
    Member

    Agreed.

  7. added a commit that references this issue on Sep 10, 2020
    804da31
  8. added a commit that references this issue on Sep 11, 2020
    a80a748
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    removal/deprecationtopic: img

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions