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

Closed
eeeps opened this Issue Sep 24, 2014 · 3 comments

Projects

None yet

3 participants

@eeeps
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:

http://ircbot.responsiveimages.org/bot/log/respimg/2014-08-14#T86684

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

@eeeps
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 (?)

@tabatkins

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
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> {

       <ol>

+       <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