[whatwg] document.readyState and its initial value

Dan Fabulich dan at fabulich.com
Sun Jun 22 15:55:49 PDT 2008


document.readyState was added to HTML5 in April of this year.
http://lists.whatwg.org/pipermail/commit-watchers-whatwg.org/2008/000652.html

http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#current
> Each document has a current document readiness. When a Document object 
> is created, it must have its current document readiness set to the 
> string "loading". Various algorithms during page loading affect this 
> value. When the value is set, the user agent must fire a simple event 
> called readystatechanged at the Document object.

As far as I can tell via google, there has been no discussion of this 
property on lists.whatwg.org, so I'd like to suggest a small enhancement 
to the spec.

HTML5 says that the current document readiness should be "loading" when 
the document is created; instead the initial state should be 
"uninitialized".

document.readyState was initially defined by Microsoft as a proprietary 
extension to DOM.  Here's their MSDN documentation of document.readyState:

http://msdn.microsoft.com/en-us/library/ms534359(VS.85).aspx
> An object's state is initially set to uninitialized, and then to
> loading. When data loading is complete, the state of the link object
> passes through the loaded and interactive states to reach the complete
> state.

I believe HTML5 should change to agree with Microsoft on this point. 
Safari and Opera have implemented document.readyState to agree with 
Microsoft and I don't think it's appropriate for HTML5 to break new ground 
here.  This matters to me because I'm trying to fix Firefox to support 
this property, and we need to know what the initial state should be.

The point is small and not very important because it's almost impossible 
to encounter an HTML document in Internet Explorer in the "uninitialized" 
state.  But I think the fix is small and uncontroversial:

Index: source
===================================================================
--- source      (revision 1790)
+++ source      (working copy)
@@ -4613,7 +4613,7 @@
    <p>Each document has a <dfn>current document readiness</dfn>. When a
    <code>Document</code> object is created, it must have its
    <span>current document readiness</span> set to the string
-  "loading". Various algorithms during page loading affect this
+  "uninitialized". Various algorithms during page loading affect this
    value. When the value is set, the user agent must <span>fire a
    simple event</span> called <code
    title="event-readystatechanged">readystatechanged</code> at the



More information about the whatwg mailing list