Re: [whatwg] scrap the srcset attribute

On 03/02/2015 09:47 AM, Tab Atkins Jr. wrote:

>
> This is much easier to write and to maintain

Is it really?

With a simple key=value pair, I can:

$src = trim($node->getAttribute('src');

Then I can check it - if it is relative, I can change it to reference 
the cdn. If it is not local, I can check to make the domain is valid, 
check the domain is not in our black list, etc. and then replace the src 
node with the cleaned version.

With srcset - I can still do that but then becomes more complex as there 
is an initial array that then has to be exploded into secondary arrays 
etc. and more complicated code is more prone to bugs.

What happens if one of the sources has a typo involving a space, e.g.

Big Image.jpg 2x

instead of

Big%20Image 2x

With key=value that's easy to fix, but it is more complicated when a 
space is a delimiter in an array that is a sub-array.

key=value is kiss and kiss has a lot of benefits.

Received on Monday, 2 March 2015 21:08:38 UTC