Re: [whatwg] Readiness of script-created documents

On Fri, 15 Jun 2012, Henri Sivonen wrote:
> On Tue, Jun 12, 2012 at 1:46 AM, Ian Hickson <ian@hixie.ch> wrote:
> > When a document is aborted the state is more or less left exactly as 
> > it was when it was aborted. This includes the readiness state. It also 
> > means no events fire (e.g. no 'load', 'unload', or 'error' events), a 
> > number of scripts just get abandoned without executing, appcache stuff 
> > gets abandoned, queued calls to window.print() get forgotten, etc.
> >
> > Aborting a document is a very heavy-handed measure. Documents are not 
> > expected to last long after they have been aborted, typically. Pages 
> > aren't expected to remain functional beyond that point.
> 
> That's not reality in all browsers right now, and I think it doesn't 
> make sense to make that the reality. That is, there already browsers 
> that transition readyState to "complete" upon aborting the parser and I 
> think doing that makes sense (and I want to change Gecko to do that, 
> too)

With you up to here. The spec has been updated to transition to 'complete' 
after it is aborted, on the principle that 'loading' means that the parser 
is still active.


> because a non-"complete" readyState is a promise to fire an "load" event 
> later.

That's not the case, though.


> I think it's a bad idea to leave a document into the "loading" state 
> when the browser engine knows that it won't fire and "load" event for 
> the document.

That's fair enough.


> Basically, I think the platform should maximize the chances of the
> following code pattern causing doStuff to run once the document has
> completely loaded:
> if (document.readyState == "complete") {
>   setTimeout(doStuff, 0);
> } else {
>   document.addEventListener("load", doStuff);
> }

I agree, but we're not talking about documents that are completely loaded 
here. We're talking about documents that get aborted. Documents that are 
aborted do not need to work, they were aborted precisely because they 
don't need to work and are no longer needed.

No 'load' event fires after a document is aborted, because it didn't load.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Wednesday, 29 August 2012 22:12:05 UTC