|
1023 | 1023 | pageTitle = document.title,
|
1024 | 1024 | isDialog = settings.role === "dialog" || toPage.jqmData( "role" ) === "dialog";
|
1025 | 1025 |
|
1026 |
| - // If we are trying to transition to the same page that we are currently on ignore the request. |
1027 |
| - // an illegal same page request is defined by the current page being the same as the url, as long as there's history |
1028 |
| - // and toPage is not an array or object (those are allowed to be "same") |
1029 |
| - // |
1030 |
| - // XXX_jblas: We need to remove this at some point when we allow for transitions |
1031 |
| - // to the same page. |
1032 |
| - if( fromPage && fromPage[0] === toPage[0] ) { |
| 1026 | + // By default, we prevent changePage requests when the fromPage and toPage |
| 1027 | + // are the same element, but folks that generate content manually/dynamically |
| 1028 | + // and reuse pages want to be able to transition to the same page. To allow |
| 1029 | + // this, they will need to change the default value of allowSamePageTransition |
| 1030 | + // to true, *OR*, pass it in as an option when they manually call changePage(). |
| 1031 | + // It should be noted that our default transition animations assume that the |
| 1032 | + // formPage and toPage are different elements, so they may behave unexpectedly. |
| 1033 | + // It is up to the developer that turns on the allowSamePageTransitiona option |
| 1034 | + // to either turn off transition animations, or make sure that an appropriate |
| 1035 | + // animation transition is used. |
| 1036 | + if( fromPage && fromPage[0] === toPage[0] && !settings.allowSamePageTransition ) { |
1033 | 1037 | isPageTransitioning = false;
|
1034 | 1038 | mpc.trigger( "pagechange", triggerData );
|
1035 | 1039 | return;
|
|
1132 | 1136 | pageContainer: undefined,
|
1133 | 1137 | showLoadMsg: true, //loading message shows by default when pages are being fetched during changePage
|
1134 | 1138 | dataUrl: undefined,
|
1135 |
| - fromPage: undefined |
| 1139 | + fromPage: undefined, |
| 1140 | + allowSamePageTransition: false |
1136 | 1141 | };
|
1137 | 1142 |
|
1138 | 1143 | /* Event Bindings - hashchange, submit, and click */
|
|
0 commit comments