Windows.Location.Hash and Chrome

Windows.Location.Hash and Chrome

I am experiencing difficulty with Chrome (version 28.0.1485.0 running on Linux - although I think it also applies to my Nexus 7 tablet running Android 4.2.2 - but I can't see what version of Chrome that is).

The problem is manifested in this jsfiddle

http://jsfiddle.net/akc42/ZmcP8/  with Firefox it works fine and the Dialog box remains popped up - with Chrome, the dialog appears and then immediately disappears.

On my desktop (jsfiddle doesn't seem to have the latest jquery mobile) I am running jquery 1.9.1 and jquery.mobile 1.3.1

I have very carefully single stepped through the code (with the Chrome developer tools) and watched what happens when we try and update the windows.location.hash on line 2482 of jquery-mobile uncompressed.  I follow the events from where they are started by the browser (in Jquery itself at line 2746) through to the first popstate handler - at 2530 - watching it stopping propagation, and effectively returning all the way to the exit of the function called by the browser native code at jquery line 2746.  In single stepping mode, as I return from that function it immediately re-enters, why I don't know, this seems to be Chrome triggering the event for a second time. This causes it to re-enter the popstate handling routine at 2530 which no longer has the this.preventHashAssignPopstate set to true, and so it does actually behave like the back button and initiate a changePage back to from whence it had just came, That page change is actually queued - because the original event point at 2482 was inside page change - but as soon as the transition to the the new page completes, it immediately dequeues and returns to the first page.