[whatwg] The src-N proposal
Tab Atkins Jr.
jackalmage at gmail.com
Fri Nov 8 12:41:57 PST 2013
On Fri, Nov 8, 2013 at 12:17 PM, Maciej Stachowiak <mjs at apple.com> wrote:
> 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.
What Maciej said. "Just use scripts" is, duh, the obvious answer (and
one that people KEEP GIVING OVER AND OVER). The problem is that this
gates the picture loading behind a script-loading time barrier, while
we *want* pictures to start loading as soon as the preload scanner
sees them, as they do today. This is a significant issue on mobile
networks especially, where time-to-request-start is very important for
the responsiveness of the page.
This sucks, because we can't program the preloader, and no one's got a
serious proposal for doing so. So, you have to solve as much as
possible in the browser itself, rather than delegating to script.
~TJ
More information about the whatwg
mailing list