Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

move event blocking to navigator object

  • Loading branch information...
commit dc376932dc9683caa93a4e20475c8098fbe2e208 1 parent 7d438a4
@johnbender johnbender authored
Showing with 14 additions and 14 deletions.
  1. +1 −1  js/jquery.mobile.navigation.js
  2. +13 −13 js/navigation/navigator.js
View
2  js/jquery.mobile.navigation.js
@@ -844,7 +844,7 @@ define( [
// Set the location hash.
if ( settings.changeHash !== false && url ) {
//disable hash listening temporarily
- urlHistory.ignoreNextHashChange = true;
+ $.navigate.navigator.ignoreNextHashChange = true;
// rebuilding the hash here since we loose it earlier on
// TODO preserve the originally passed in path
View
26 js/navigation/navigator.js
@@ -77,9 +77,9 @@ define([ "jquery", "./events/navigate", "./path", "./history" ], function( $ ) {
// history management. In the case of hashchange we don't swallow it
// if there will be no hashchange fired (since that won't reset the value)
// and will swallow the following hashchange
- this.history.ignoreNextHashChange = true;
+ this.ignoreNextHashChange = true;
if( noEvents && hash !== path.stripHash(path.parseLocation().hash) ) {
- this.history.preventNextHashChange = noEvents;
+ this.preventNextHashChange = noEvents;
}
// IMPORTANT in the case where popstate is supported the event will be triggered
@@ -112,7 +112,7 @@ define([ "jquery", "./events/navigate", "./path", "./history" ], function( $ ) {
// Trigger a new faux popstate event to replace the one that we
// caught that was triggered by the hash setting above.
if( !noEvents ) {
- this.history.ignoreNextPopState = true;
+ this.ignoreNextPopState = true;
$( window ).trigger( popstateEvent );
}
}
@@ -142,16 +142,16 @@ define([ "jquery", "./events/navigate", "./path", "./history" ], function( $ ) {
// If this is the popstate triggered by the actual alteration of the hash
// prevent it completely to prevent handling
- if( this.history.ignoreNextHashChange ) {
- this.history.ignoreNextHashChange = false;
+ if( this.ignoreNextHashChange ) {
+ this.ignoreNextHashChange = false;
event.stopImmediatePropagation();
return;
}
// if this is the popstate triggered after the replaceState call in the navigate
// method, then simply ignore it
- if( this.history.ignoreNextPopState ) {
- this.history.ignoreNextPopState = false;
+ if( this.ignoreNextPopState ) {
+ this.ignoreNextPopState = false;
return;
}
@@ -219,9 +219,9 @@ define([ "jquery", "./events/navigate", "./path", "./history" ], function( $ ) {
// On occasion explicitly want to prevent the next hash from propogating because we only
// with to alter the url to represent the new state do so here
- if( this.history.preventNextHashChange ){
- this.history.preventNextHashChange = false;
- this.history.ignoreNextHashChange = false;
+ if( this.preventNextHashChange ){
+ this.preventNextHashChange = false;
+ this.ignoreNextHashChange = false;
event.stopImmediatePropagation();
return;
}
@@ -229,13 +229,13 @@ define([ "jquery", "./events/navigate", "./path", "./history" ], function( $ ) {
// If the hashchange has been explicitly ignored or we have no history at
// this point skip the history managment and the addition of the history
// entry to the event for the `navigate` bindings
- if( this.history.ignoreNextHashChange ) {
- this.history.ignoreNextHashChange = false;
+ if( this.ignoreNextHashChange ) {
+ this.ignoreNextHashChange = false;
}
// If the stack is empty (it's been reset or some such) don't return,
// we need to record it in the missing callback below.
- if( this.history.ignoreNextHashChange && this.history.stack.length > 0 ) {
+ if( this.ignoreNextHashChange && this.history.stack.length > 0 ) {
return;
}
Please sign in to comment.
Something went wrong with that request. Please try again.