find the next entry in the urlstack that isn't a dialog Fixes #1061

This commit is contained in:
ahallerblu 2011-03-04 23:34:12 -08:00 committed by John Bender
parent 3b21481cee
commit 291bb306dd

View file

@ -660,7 +660,20 @@
//if there's a data-rel=back attr, go back in history
if( $this.is( "[data-rel='back']" ) ){
window.history.back();
var currentIndex = $.mobile.urlHistory.activeIndex, backToIndex;
// for each history entry that is not the current page (currentIndex - 1)
for(var i = currentIndex - 1; i >= 0; i--){
backToIndex = i;
// break when we've found the first page that isn't a dialog
if($.mobile.urlHistory.stack[i].url.indexOf(dialogHashKey) < 0 ){
break;
}
}
//use the difference between closest non dialog index and the current index
window.history.go(backToIndex - currentIndex);
return false;
}