Re: [whatwg] History: onpopstate on initial document load

On Thu, Aug 16, 2012 at 2:54 AM, Jonas Sicking <jonas@sicking.cc> wrote:

>  The spec used to call for "popstate" to always fire during page load
> (I forget exactly at which point it would fire, I believe right around
> when the "load" event fire). However this was deemed both confusing
> and unneccesary. Instead we introduced the history.state property
> which remove the need for this.
>
> I wrote a blog post about this here after having discussed this with
> Chrome engineers:
> https://hacks.mozilla.org/2011/03/history-api-changes-in-firefox-4/
>
> It was generally accepted by all parties that this was a better
> approach so it's unfortunate if the spec still calls for popstate to
> be fired during pageload.
>

It looks like it's meant to be fired, but before any scripts are run to set
up listeners.  That's almost the same thing as not firing it at all, except
for @onpopstate.  (I don't know if there are any other corner
cases--iframes or something.)  Maybe there's something I'm missing that
should prevent @onpopstate from being invoked here.

-- 
Glenn Maynard

Received on Sunday, 19 August 2012 03:56:27 UTC