- From: Ian Hickson <ian@hixie.ch>
- Date: Tue, 5 Aug 2008 06:29:06 +0000 (UTC)
On Mon, 23 Jun 2008, Frode B?rli wrote: > > 1. Which readystate does an img object have, before it is added to the > DOM? Example: > > var i = document.createElement("IMG"); > alert(i.readystate); // afaict the state SHOULD be uninitialized here... > i.onreadystatechange(function(){alert(this.readystate);} > i.src = "some_url.jpg"; > alert(i.readystate); It seems only IE supports this property, so hopefully we don't need to spec it (or support it in other UAs). > The example applies to iframes as well, i believe. I couldn't reproduce this. > 2. How can we listen to the onreadystatechange, if we want to trigger an > event when the object starts loading? It will not change readystate > since it was already in the state loading. In HTML5 there's no way to get an event when an <img> begins loading. It begins loading when the src="" is set. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 4 August 2008 23:29:06 UTC