Skip to content

Responsive images: should we define source selection normatively instead of leaving it implementation-defined #13077

Open

Description

@noamr

What is the issue with the HTML Standard?

All three engines implement the same rule:

  • sort by density
  • pick the first candidate whose density ≥ the device pixel ratio (including page zoom)
  • if none, pick the last.

There is one blink-related optimization to prefer an already-loaded higher-density candidate, but it's an interop issue and rarely used.

The implementation-defined facade is costly:

Proposing to cement the existing behavior. If UAs want to do something different in the future, we can review whether implementation-defined behavior would be web compatible.

Note CSS is in the same state — css-images-4 says image-set() lets "the UA decide which is most appropriate". Blink unified the two in 2024; defining one gives the CSSWG something to reference.

Activity

  1. eeeps commented on Oct 14, 2026

    @eeeps
    Contributor

    One more datapoint to inform this decision that I just remembered, about whether and how UAs use the flexibility the spec currently offers them... when devicePixelRatio was >1, Chrome used to pick the closest resource (by geometric mean) to the density target, rather than the smallest one that was larger. So when offered a 1.9x resource and a 3x resource when trying to hit a 2x target, Chrome would pick the 1.9x, while Safari and Firefox would pick the 3x.

    I just tested and this no longer seems to be the case, but I'm pretty sure it was the last time I looked, in 2024.

    When did this change, and why? Presumably interop?

  2. noamr commented on Oct 14, 2026

    @noamr
    ContributorAuthor

    3. One more datapoint to inform this decision that I just remembered, about whether and how UAs use the flexibility the spec currently offers them... when devicePixelRatio was >1, Chrome used to pick the closest resource (by geometric mean) to the density target, rather than the smallest one that was larger. So when offered a 1.9x resource and a 3x resource when trying to hit a 2x target, Chrome would pick the 1.9x, while Safari and Firefox would pick the 3x.
    I just tested and this no longer seems to be the case, but I'm pretty sure it was the last time I looked, in 2024.
    When did this change, and why? Presumably interop?

    This would be chromium/chromium@c1e91d248c.
    Yea, the ratio of complexity cost vs. measurable value for browsers to maintain this kind of divergence wasn't worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions