Closed thom4parisot closed 10 years ago
@oncletom So is this proposal literally just automating the data-src
attribute so the user doesn't have to specify an initial value (as that would be changed by Imager.js any way if the browser was outside the range of the specified width).
If that's what the intent is of this proposal then I think that's a good first start and worth cracking on with.
If that's not the intent and there is more work involved then please let me know.
@Integralist I've fixed the typo and made the setTimeout
more explicit in tests.
@oncletom cool, looks good
The intention
Imager is actually quite flexible on the
data-src
pattern as long as you master regular expressions.Also, user needs might be simpler than a RegExp pattern that in most of the case.
The proposal
Controlling the replacement from
data-src
directly by using URI Template-like string variables (in fact deeply simplified).From:
To:
{width}
is either replaced by any suitableavailableWidths
numeric value or, by default bydata-width
's value.Additional PR will provide
{width}
interpolation (to replace by a string value, Flickr or Guardian case) and pixel density adjustement (eventually through a callback to deal with more complex replacement)