[whatwg] Promise-vending loaded() & ready() methods on various elements

Boris Zbarsky bzbarsky at MIT.EDU
Wed Mar 12 07:26:51 PDT 2014


On 3/12/14 10:17 AM, Domenic Denicola wrote:
> With promises you should only ask for the "loaded" promise *after* setting `src`

Ah, fair.

I'd been hoping we could get away without having to very carefully order 
the code, but I'm just not seeing a way to do that.

> Except, I suppose, for the base-case of images with no src, transitioning to having an src? Or are they considered to have e.g. loaded `about:blank` already?

They're not right now.

> // (2) or will promise1 and promise2 fulfill at the same time, since promise1 waits until a src appears?

This is what will happen in current implementations if nothing special 
is done.

> // (4) or it could be rejected with an "InvalidStateError" saying you can't wait for the loading of a non-src'ed image.

This would make some sense, yes.

-Boris



More information about the whatwg mailing list