Skip to content

Commit df9e233

Browse files
committed
extra comments for clarity
1 parent 8a994d3 commit df9e233

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

js/jquery.mobile.navigation.pushstate.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
};
3535
},
3636

37+
// on hash change we want to clean up the url
38+
// NOTE this takes place *after* the vanilla navigation hash change
39+
// handling has taken place and set the state of the DOM
3740
onHashChange: function( e ) {
3841
var href, state;
3942

@@ -53,6 +56,8 @@
5356
}
5457
},
5558

59+
// on popstate (ie back or forward) we need to replace the hash that was there previously
60+
// cleaned up by the additional hash handling
5661
onPopState: function( e ) {
5762
var poppedState = e.originalEvent.state;
5863

@@ -61,7 +66,7 @@
6166
if( poppedState ) {
6267

6368
// replace the current url with the equivelant hash so that the hashchange binding in vanilla nav
64-
// can load the page
69+
// can do its thing one triggered below
6570
history.replaceState( poppedState, poppedState.title, poppedState.initialHref + poppedState.hash );
6671

6772
// Urls that reference subpages will fire their own hashchange, so we don't want to trigger 2 in that case.

0 commit comments

Comments
 (0)