[whatwg] The src-N proposal
mjs at apple.com
Fri Nov 8 12:17:31 PST 2013
On Nov 8, 2013, at 11:46 AM, Ian Hickson <ian at hixie.ch> wrote:
> On Fri, 8 Nov 2013, Rafael Rinaldi wrote:
>> It looks complex because it tries to solve something complex. I think
>> there’s no way to avoid verbosity to solve such thing.
> The way you avoid complexity in such things is that you don't solve the
> overall problem, you solve small segments of the problem (e.g. in script
> or CSS), then pick the solution you want.
> So for example, we could have a script to handle image grids, another to
> handle simple cases where as the window gets wider you display more
> context in the image, etc. If all these scripts have some common features
> they all need (e.g. the ability to work with pre-parsing to say which
> image they need first, so it can be fetched early) then we can provide
> that common core.
If you look at primitives that exist today (excluding src-N), the fundamental thing that's missing is ability to have one of several images correctly selected by the browser at preload time. Other than that, the proposed behavior can be faithfully implemented with script.
The closest you can get today is to preload your best guess of the right image (by putting it in src and then changing with script), or preload nothing and only start loading once your script runs.
Offhand I can't think of a way to solve the preloading problem other than with a selection syntax that can be performed by the browser. Running script before the preloader does its pass would defeat the purpose of the preloader.
More information about the whatwg