Skip to content

Commit 328d58b

Browse files
committed
fixed role retention issue from clearing the dom cache
1 parent c3bac78 commit 328d58b

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

js/jquery.mobile.navigation.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,13 @@
258258
},
259259

260260
// addNew is used whenever a new page is added
261-
addNew: function( url, transition, title, pageUrl ) {
261+
addNew: function( url, transition, title, pageUrl, role ) {
262262
//if there's forward history, wipe it
263263
if( urlHistory.getNext() ) {
264264
urlHistory.clearForward();
265265
}
266266

267-
urlHistory.stack.push( {url : url, transition: transition, title: title, pageUrl: pageUrl } );
267+
urlHistory.stack.push( {url : url, transition: transition, title: title, pageUrl: pageUrl, role: role } );
268268

269269
urlHistory.activeIndex = urlHistory.stack.length - 1;
270270
},
@@ -942,7 +942,7 @@
942942

943943
//add page to history stack if it's not back or forward
944944
if( !historyDir ) {
945-
urlHistory.addNew( url, settings.transition, pageTitle, pageUrl );
945+
urlHistory.addNew( url, settings.transition, pageTitle, pageUrl, settings.role );
946946
}
947947

948948
//set page title
@@ -1188,7 +1188,7 @@
11881188
//hashchange event handler
11891189
$window.bind( "hashchange", function( e, triggered ) {
11901190
//find first page via hash
1191-
var to = path.stripHash( location.hash ),
1191+
var role, to = path.stripHash( location.hash ),
11921192
//transition is false if it's the first page, undefined otherwise (and may be overridden by default)
11931193
transition = $.mobile.urlHistory.stack.length === 0 ? "none" : undefined;
11941194

@@ -1199,8 +1199,7 @@
11991199
}
12001200

12011201
// special case for dialogs
1202-
if( urlHistory.stack.length > 1 &&
1203-
to.indexOf( dialogHashKey ) > -1 ) {
1202+
if( urlHistory.stack.length > 1 && to.indexOf( dialogHashKey ) > -1 ) {
12041203

12051204
// If current active page is not a dialog skip the dialog and continue
12061205
// in the same direction
@@ -1216,7 +1215,11 @@
12161215
// prevent changepage
12171216
return;
12181217
} else {
1219-
var setTo = function() { to = $.mobile.urlHistory.getActive().pageUrl; };
1218+
var setTo = function() {
1219+
var active = $.mobile.urlHistory.getActive();
1220+
to = active.pageUrl;
1221+
role = active.role;
1222+
};
12201223
// if the current active page is a dialog and we're navigating
12211224
// to a dialog use the dialog objected saved in the stack
12221225
urlHistory.directHashChange({ currentUrl: to, isBack: setTo, isForward: setTo });
@@ -1226,11 +1229,11 @@
12261229
//if to is defined, load it
12271230
if ( to ) {
12281231
to = ( typeof to === "string" && !path.isPath( to ) ) ? ( '#' + to ) : to;
1229-
$.mobile.changePage( to, { transition: transition, changeHash: false, fromHashChange: true } );
1232+
$.mobile.changePage( to, { transition: transition, changeHash: false, fromHashChange: true , role: role} );
12301233
}
12311234
//there's no hash, go to the first page in the dom
12321235
else {
1233-
$.mobile.changePage( $.mobile.firstPage, { transition: transition, changeHash: false, fromHashChange: true } );
1236+
$.mobile.changePage( $.mobile.firstPage, { transition: transition, changeHash: false, fromHashChange: true, roll: rolle } );
12341237
}
12351238
});
12361239

0 commit comments

Comments
 (0)