W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2015

Re: [whatwg] scrap the srcset attribute

From: Michael A. Peters <mpeters@domblogger.net>
Date: Mon, 02 Mar 2015 13:08:09 -0800
Message-ID: <54F4D139.9070204@domblogger.net>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: "whatwg@whatwg.org" <whatwg@whatwg.org>


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

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