[whatwg] document.readyState and its initial value

Frode Børli frode at seria.no
Mon Jun 23 00:27:19 PDT 2008

>> As far as I know I can't exhibit a test demonstrating IE switching from
>> "uninitialized" to "loading."  The document is normally in the "loading"
>> state before you get your hands on it.
> Ok, that matches my experience too -- that's why the spec says what it
> says. :-) (The spec, when it is documenting IE features, is more about
> documenting actual IE behaviour than about MSDN, which is notoriously
> unreliable.)

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.src = "some_url.jpg";

The example applies to iframes as well, i believe.

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.

> Should that happen, we can revisit the issue... of course at that point IE
> would be non-conforming, so maybe it would just be considered a bug. :-)
>> It's tempting to say that the readyState can start with either
>> "uninitialized" or "loading"; certainly it's odd that we'd just hike it
>> up to "loading" because our test mechanisms are usually too
>> coarse-grained to detect a readyState in its "uninitialized" state.

The state should not be "loading" when the object is in fact, not
loading nor in any of the other states...


More information about the whatwg mailing list