diff --git a/js/jquery.mobile.forms.select.js b/js/jquery.mobile.forms.select.js index a78445bc508..7caa3224181 100644 --- a/js/jquery.mobile.forms.select.js +++ b/js/jquery.mobile.forms.select.js @@ -199,6 +199,11 @@ $.widget( "mobile.selectmenu", $.mobile.widget, { this.setButtonCount(); }, + // open and close preserved in native selects + // to simplify users code when looping over selects + open: $.noop, + close: $.noop, + disable: function() { this._setDisabled( true ); this.button.addClass( "ui-disabled" ); diff --git a/js/jquery.mobile.listview.js b/js/jquery.mobile.listview.js index e674de67073..ee94e12eab1 100644 --- a/js/jquery.mobile.listview.js +++ b/js/jquery.mobile.listview.js @@ -79,7 +79,7 @@ $.widget( "mobile.listview", $.mobile.widget, { $li = this.element.children( "li" ); // at create time the li are not visible yet so we need to rely on .ui-screen-hidden $visibleli = create?$li.not( ".ui-screen-hidden" ):$li.filter( ":visible" ); - + this._removeCorners( $li ); // Select the first visible li element @@ -206,7 +206,7 @@ $.widget( "mobile.listview", $.mobile.widget, { self._itemApply( $list, item ); } - + this._refreshCorners( create ); }, @@ -269,8 +269,12 @@ $.widget( "mobile.listview", $.mobile.widget, { }).listview(); - //on pagehide, remove any nested pages along with the parent page, as long as they aren't active - if( hasSubPages && parentPage.data("page").options.domCache === false ){ + // on pagehide, remove any nested pages along with the parent page, as long as they aren't active + // and aren't embedded + if( hasSubPages && + parentPage.is( "jqmData(external-page='true')" ) && + parentPage.data("page").options.domCache === false ) { + var newRemove = function( e, ui ){ var nextPage = ui.nextPage, npURL; diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js index afcb6d1fe95..69068730f1b 100755 --- a/js/jquery.mobile.navigation.js +++ b/js/jquery.mobile.navigation.js @@ -398,7 +398,7 @@ $.mobile.changePage.apply( null, pageTransitionQueue.pop() ); } } - + // Save the last scroll distance per page, before it is hidden var getLastScroll = (function( lastScrollEnabled ){ return function(){ @@ -406,18 +406,18 @@ lastScrollEnabled = true; return; } - + lastScrollEnabled = false; - + var active = $.mobile.urlHistory.getActive(), activePage = $( ".ui-page-active" ), scrollElem = $( window ), touchOverflow = $.support.touchOverflow && $.mobile.touchOverflowEnabled; - + if( touchOverflow ){ scrollElem = activePage.is( ".ui-native-fixed" ) ? activePage.find( ".ui-content" ) : activePage; - } - + } + if( active ){ var lastScroll = scrollElem.scrollTop(); @@ -427,12 +427,12 @@ } }; })( true ); - + // to get last scroll, we need to get scrolltop before the page change // using beforechangepage or popstate/hashchange (whichever comes first) $( document ).bind( "beforechangepage", getLastScroll ); $( window ).bind( $.support.pushState ? "popstate" : "hashchange", getLastScroll ); - + // Make the iOS clock quick-scroll work again if we're using native overflow scrolling /* if( $.support.touchOverflow ){ @@ -454,7 +454,7 @@ touchOverflow = $.support.touchOverflow && $.mobile.touchOverflowEnabled, toScroll = active.lastScroll || ( touchOverflow ? 0 : $.mobile.defaultHomeScroll ), screenHeight = getScreenHeight(); - + // Scroll to top, hide addr bar window.scrollTo( 0, $.mobile.defaultHomeScroll ); @@ -462,22 +462,22 @@ //trigger before show/hide events fromPage.data( "page" )._trigger( "beforehide", null, { nextPage: toPage } ); } - + if( !touchOverflow){ toPage.height( screenHeight + toScroll ); - } - + } + toPage.data( "page" )._trigger( "beforeshow", null, { prevPage: fromPage || $( "" ) } ); //clear page loader $.mobile.hidePageLoadingMsg(); - + if( touchOverflow && toScroll ){ - + toPage.addClass( "ui-mobile-pre-transition" ); // Send focus to page as it is now display: block reFocus( toPage ); - + //set page's scrollTop to remembered distance if( toPage.is( ".ui-native-fixed" ) ){ toPage.find( ".ui-content" ).scrollTop( toScroll ); @@ -500,7 +500,7 @@ // Send focus to the newly shown page reFocus( toPage ); } - + // Jump to top or prev scroll, sometimes on iOS the page has not rendered yet. if( !touchOverflow ){ $.mobile.silentScroll( toScroll ); @@ -511,7 +511,7 @@ if( !touchOverflow ){ fromPage.height( "" ); } - + fromPage.data( "page" )._trigger( "hide", null, { nextPage: toPage } ); } @@ -533,7 +533,7 @@ return pageMin; } - + $.mobile.getScreenHeight = getScreenHeight; //simply set the active page's minimum height to screen height, depending on orientation @@ -784,8 +784,12 @@ } //append to page and enhance + // TODO taging a page with external to make sure that embedded pages aren't removed + // by the various page handling code is bad. Having page handling code in many + // places is bad. Solutions post 1.0 page .attr( "data-" + $.mobile.ns + "url", path.convertUrlToDataUrl( fileUrl ) ) + .attr( "data-" + $.mobile.ns + "external-page", true ) .appendTo( settings.pageContainer ); // wait for page creation to leverage options defined on widget @@ -920,7 +924,7 @@ mpc.trigger( pbcEvent, triggerData ); mpc.trigger( "beforechangepage", triggerData ); // XXX: DEPRECATED for 1.0 - + // If the default behavior is prevented, stop here! if( pbcEvent.isDefaultPrevented() ){ return; diff --git a/tests/unit/listview/index.html b/tests/unit/listview/index.html index 9a9c93de9fa..e8b787163e8 100644 --- a/tests/unit/listview/index.html +++ b/tests/unit/listview/index.html @@ -33,6 +33,7 @@