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

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

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?



Received on Sunday, 22 September 2013 11:05:47 UTC