W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2013

[whatwg] The srcset attribute - some implementation feedback & questions

From: Yoav Weiss <yoav@yoav.ws>
Date: Sun, 22 Sep 2013 13:05:20 +0200
Message-ID: <CACj=BEj0CLEP1BjG1-8G=b9ruzXVCkG2DBqx99PDSp6C6fCsSw@mail.gmail.com>
To: WHATWG <whatwg@whatwg.org>
I've recently ported the WebKit srcset implementation into Blink, and
pretty much rewrote it in the process.

I'd like to provide some feedback and ask for clarifications, in order to
improve the implementation's spec[1] compliance. Below I'll discuss the
algorithm's step and points that I'd like clarifications on.

Step 5
----------
What happens when the srcset attribute is of the form "candidate1.png,
candidate2.png 2x"?
As far as I understand it, according to the spec it results in a single
image candidate url "candidate1.png," followed by the descriptors
"candidate2.png 2x", which is probably not what the author intended.
As a note, both WebKit & Blink implementations diverge from the spec here,
by adding a "check if the URL's last char is ',' and if so, continue
without trying to parse out descriptors" step. This also enables the
implementations to ignore empty candidates such as "candidate1.png 1x, , ,
, , candidate2.png 2x".

A similar case of <img srcset="candidate1.png,candidate2.png 2x"> results
in the image candidate URL being "candidate1.png,candidate2.png". Is that
the correct behavior?
I'm not sure what should be the result here (since splitting on commas will
break data URIs), but I'm certain this will be a source of confusion for
authors.

Step 13.6
------------
What happens when one of the valid qualifier characters is followed by
other non qualifier chars? e.g.is "2xbla" a valid descriptor?

What happens when one of the valid qualifier characters is followed by
another qualifier char? e.g.is "2xwh" a valid descriptor? Does it set all
three variables to 2?

What happens to invalid descriptors? If I understand correctly, invalid
descriptors should just be ignored so that "2x 500tt bla" will results in a
density of 2, width of infinity and height of infinity.
Is that correct?

Yoav

[1]
http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html#processing-the-image-candidates
Received on Sunday, 22 September 2013 11:05:47 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:09 UTC