On Mon, 02 Mar 2015 22:08:09 +0100, Michael A. Peters <mpet...@domblogger.net> wrote:



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.

We can add an API to expose the parsed candidates, or some such, but we need to understand the use cases that it would solve. As Tab said, your use case seems better solved on the server. Are there other use cases?

--
Simon Pieters
Opera Software

Reply via email to