Drop candidates with `w` descriptors if `w`is unsupported #244

eeeps opened this Issue Sep 24, 2014 · 3 comments


None yet

3 participants

eeeps commented Sep 24, 2014

Per #239, given:

<img src="fallback.jpg" srcset="a.jpg 100h, b.jpg 200h" />

In a browser that doesn’t support h, we drop both candidates and the src is picked.

But given:

<img src="fallback.jpg" srcset="a.jpg 100w, b.jpg 200w" />

In a browser that supports x, but not w, (like, oh, iOS 8 Safari, or Safari 7.1), behavior is unspecified. I think it should be spec'd to mirror h; drop both srcset candidates and fall back to the src.

I think @yoavweiss already made this change in WebKit:


...shame it didn't make it into the released versions.

eeeps commented Sep 24, 2014

It occurs to me that maybe I should have titled this “Drop candidates with only w descriptors if w is unsupported”. Not that anyone should be writing stuff like srcset="a.jpg 2x 320w", but if they do, it probably makes sense to use the 2x & candidate (?)


Browsers shouldn't be partially implementing in the first place; they just need to support w descriptors properly. (But I'll comment on the other thread, where I have a more relevant opinion.)

zcorpan commented Sep 26, 2014

Proposed change:

diff --git a/source b/source
index 57121db..f5280c9 100644
--- a/source
+++ b/source
@@ -1738,6 +1738,16 @@ interface <dfn>HTMLImageElement</dfn> : <span>HTMLElement</span> {


+       <li>
+        <p>If the user agent does not support the <code data-x="attr-img-sizes">sizes</code> attribute,
+        let <var>error</var> be <i>yes</i>.</p>
+        <p class="note">A conforming user agent will support the <code data-x="attr-img-sizes">sizes</code> attribute.
+        However, user agents typically implement and ship features in an incremental manner in practice.</p>
+       </li>
        <li><p>If <var>width</var> and <var>density</var>
        are not both <i>absent</i>,
        then let <var>error</var> be <i>yes</i>.</p></li>
@zcorpan zcorpan closed this in 0e65426 Sep 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment