Permalink
Browse files

Fixes #2537 - Add new pageremove event

- Modified the pagehide callback in $.mobile._bindPageRemove() so that it fires off a "pageremove" event. Callbacks can prevent the removal of the page by simply calling preventDefault() on the pagremove event object that is passed to their callback.
  • Loading branch information...
1 parent ca9df11 commit 34fb7b2dc1b961ff0284f5b878ffefbe2a44ad51 @jblas jblas committed Sep 28, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 js/jquery.mobile.navigation.js
@@ -662,7 +662,14 @@
&& page.is(":jqmData(external-page='true')") ) {
page.bind( 'pagehide.remove', function() {
- $( this ).removeWithDependents();
+ var $this = $( this ),
+ prEvent = new $.Event( "pageremove" );
+
+ $this.trigger( prEvent );
+
+ if( !prEvent.isDefaultPrevented() ){
+ $this.removeWithDependents();
+ }
});
}
};

0 comments on commit 34fb7b2

Please sign in to comment.