|
34 | 34 | }; |
35 | 35 | }, |
36 | 36 |
|
37 | | - isSubHashPage: function( page ) { |
38 | | - var pageUrl = page.jqmData("url") || ""; |
39 | | - |
40 | | - // if the page is a dialog, a subpage, or an embedded page |
41 | | - // then the hash will have been maintained |
42 | | - return page.is( "[role='dialog']" ) || |
43 | | - pageUrl.indexOf( $.mobile.subPageUrlKey ) >= 0 || |
44 | | - pageUrl === page.attr( "id" ); |
45 | | - }, |
46 | | - |
47 | 37 | resetUIKeys: function( url ) { |
48 | 38 | var dialog = $.mobile.dialogHashKey, |
49 | 39 | subkey = "&" + $.mobile.subPageUrlKey, |
|
90 | 80 | // if there's no state its not a popstate we care about, ie chrome's initial popstate |
91 | 81 | // or forward popstate |
92 | 82 | if( poppedState ) { |
93 | | - // can't test the hash directly because the url has already been altered, possibly to |
94 | | - // one without a hash, so we check if the page on display is one that would have |
95 | | - // generated a hash. Generally speaking a crappy solution. |
96 | | - if( self.isSubHashPage( $.mobile.activePage ) ){ |
97 | | - holdnexthashchange = true; |
98 | | - } |
99 | | - |
100 | | - // change the page based on the hash |
101 | | - $.mobile._handleHashChange( poppedState.hash ); |
102 | | - |
103 | | - // disable the next hash change if the page we came from has a hash |
104 | | - $.mobile.urlHistory.ignoreNextHashChange = holdnexthashchange; |
| 83 | + // disable any hashchange triggered by the browser |
| 84 | + $.mobile.urlHistory.ignoreNextHashChange = true; |
| 85 | + |
| 86 | + // defer our manual hashchange until after the browser fired |
| 87 | + // version has come and gone |
| 88 | + setTimeout(function() { |
| 89 | + // make sure that the manual hash handling takes place |
| 90 | + $.mobile.urlHistory.ignoreNextHashChange = false; |
| 91 | + |
| 92 | + // change the page based on the hash |
| 93 | + $.mobile._handleHashChange( poppedState.hash ); |
| 94 | + }); |
105 | 95 | } |
106 | 96 | }, |
107 | 97 |
|
|
0 commit comments