Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #5800 from jquery/fix-5775

A fix for issue #5775
  • Loading branch information...
commit 2151fc163ad1b4d93c1d58f53bcd0460ea3864b5 2 parents 8304b9c + 3627bff
@gabrielschulhof gabrielschulhof authored
View
8 js/jquery.mobile.navigation.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;
View
1  js/navigation/navigator.js
@@ -190,6 +190,7 @@ define(["jquery",
this.ignoreInitialHashChange ) {
this.ignoreInitialHashChange = false;
+ event.preventDefault();
return;
}
View
7 tests/jquery.testHelper.js
@@ -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;
};
Please sign in to comment.
Something went wrong with that request. Please try again.