[whatwg] Onpopstate is Flawed

Mihai Parparita mihaip at chromium.org
Wed Feb 2 13:46:15 PST 2011


In terms of spec changes:
- Step 5 in http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#dom-history-replacestate
would be changed to set a flag if the ready state is not "complete"
- Same thing in step 11
http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#traverse-the-history
- On http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#pending-state-object
mention that the initial popstate will not be fired if the flag is set

Does that sound right?

Mihai

On Mon, Jan 31, 2011 at 6:32 PM, Jonas Sicking <jonas at sicking.cc> wrote:
> If pushState or replaceState is called before the initial popstate,
> simply don't fire the after-onload-popstate.
>
> If the back button is pressed (or history.back() is called) after a
> pushState/replaceState, but before onload, fire a popstate for the
> newly transitioned to state. Still leave the after-onload-popstate
> canceled.
>
> I.e. if the webpage calls pushState or replaceState before onload
> fires, then it is deemed that the page has transitioned to the new
> state and no after-onload-popstate is needed.
>
> This behavior makes the most sense to me and allows the page to start
> handling state transitions before the page finishes loading.
>
> / Jonas
>



More information about the whatwg mailing list