[whatwg] Navigation events generated during unload

Ian Hickson ian at hixie.ch
Sat Oct 17 02:12:48 PDT 2009


On Tue, 13 Oct 2009, Boris Zbarsky wrote:
> On 10/13/09 10:58 PM, Ian Hickson wrote:
> > Ah, I see. Yes, that makes sense. Are you ok with what the spec says 
> > despite this minor difference? (It seems that what the spec says is a 
> > mote more self-consistent, but I could be biased! ;-) )
> 
> Can you point me to the relevant spec text?

Sure.

The 'beforeunload' and 'unload' events are described in algorithsm here:

   http://www.whatwg.org/specs/web-apps/current-work/multipage/#unloading-documents

If you click the "prompt to unload the document" and "unload a document" 
bits you'll get links to the algorithsm that use them. In particular, the 
"navigate" algorithm:

   http://www.whatwg.org/specs/web-apps/current-work/complete.html#navigate

Step 3 is the one that prevents a browsing context from being navigated 
while 'unload' is running.

Step 8 is the one that runs 'beforeunload'.

Step 17 references algorithms that each later reference the "update the 
session history with the new page" algorithm:

   http://www.whatwg.org/specs/web-apps/current-work/complete.html#update-the-session-history-with-the-new-page

Step 1 of that algorithm invokes 'unload'.

Sorry for linking to complete.html; the multipage copy is currently 
undergoing maintenance as I write this. If you replace "complete.html" 
with "multipage/" then you will get redirected to the multipage version.

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



More information about the whatwg mailing list