Permalink
Browse files

Merge pull request #5800 from jquery/fix-5775

A fix for issue #5775
  • Loading branch information...
gabrielschulhof committed Mar 25, 2013
2 parents 8304b9c + 3627bff commit 2151fc163ad1b4d93c1d58f53bcd0460ea3864b5
Showing with 15 additions and 1 deletion.
  1. +7 −1 js/jquery.mobile.navigation.js
  2. +1 −0 js/navigation/navigator.js
  3. +7 −0 tests/jquery.testHelper.js
@@ -1345,7 +1345,13 @@ define( [
// TODO roll the logic here into the handleHashChange method
$window.bind( "navigate", function( e, data ) {
var url = $.event.special.navigate.originalEventName.indexOf( "hashchange" ) > -1 ? data.state.hash : data.state.url;
var url;
if ( e.originalEvent && e.originalEvent.isDefaultPrevented() ) {
return;
}
url = $.event.special.navigate.originalEventName.indexOf( "hashchange" ) > -1 ? data.state.hash : data.state.url;
if( !url ) {
url = $.mobile.path.parseLocation().hash;
@@ -190,6 +190,7 @@ define(["jquery",
this.ignoreInitialHashChange ) {
this.ignoreInitialHashChange = false;
event.preventDefault();
return;
}
@@ -429,6 +429,13 @@
start();
});
// If the popstate resulting from the hash assignment below happens
// early enough during initial page load, the initial popstate emitted
// by webkit browsers (which needs to be ignored) will actually coincide
// with the popstate event caused by the assignment below. If that is
// the case, then we must ensure that the navigator does not treat the
// popstate event as the initial popstate event, thereby ignoring it.
$.mobile.navigate.navigator.ignoreInitialHashChange = false;
location.hash = location.hash.replace("#", "") === hash ? "" : "#" + hash;
};

0 comments on commit 2151fc1

Please sign in to comment.