From 606bfe5f8ebf7dff3dcaf359b299fc8554ba56f8 Mon Sep 17 00:00:00 2001 From: scottjehl Date: Fri, 13 Jan 2012 20:11:52 +0700 Subject: [PATCH] removed all internal usage of the touch overflow support test and enabled flag. Still leaving both defined, however. --- css/structure/jquery.mobile.core.css | 26 --------------------- js/jquery.mobile.forms.select.custom.js | 5 ++-- js/jquery.mobile.init.js | 18 -------------- js/jquery.mobile.navigation.js | 31 ++++++------------------- js/jquery.mobile.transition.js | 20 +++------------- 5 files changed, 12 insertions(+), 88 deletions(-) diff --git a/css/structure/jquery.mobile.core.css b/css/structure/jquery.mobile.core.css index e36ab9d6..51b05ae2 100644 --- a/css/structure/jquery.mobile.core.css +++ b/css/structure/jquery.mobile.core.css @@ -24,32 +24,6 @@ div.ui-mobile-viewport { overflow-x: hidden; } .ui-mobile, .ui-mobile .ui-page { min-height: 300px; } } -/* native overflow scrolling */ -.ui-page.ui-mobile-touch-overflow, -.ui-page.ui-mobile-touch-overflow.ui-page-header-fixed .ui-content, -.ui-page.ui-mobile-touch-overflow.ui-page-footer-fixed .ui-content { - overflow: auto; - height: 100%; - left: 0; - right: 0; - -webkit-overflow-scrolling: touch; - -moz-overflow-scrolling: touch; - -o-overflow-scrolling: touch; - -ms-overflow-scrolling: touch; - overflow-scrolling: touch; -} -.ui-page.ui-mobile-touch-overflow.ui-page-header-fixed { - overflow: visible; -} -.ui-page.ui-mobile-touch-overflow, -.ui-page.ui-mobile-touch-overflow * { - /* some level of transform keeps elements from blinking out of visibility on iOS */ - -webkit-transform: rotateY(0); -} -.ui-page.ui-mobile-pre-transition { - display: block; -} - /* loading screen */ .ui-loading .ui-loader { display: block; } .ui-loader { background-color: #000; opacity: .18; display: none; z-index: 9999999; position: fixed; width: 46px; height: 46px; top: 50%; box-shadow: 0 1px 1px -1px #fff; margin-left: -18px; margin-top: -18px; left: 50%; padding: 1px; border:0; -webkit-border-radius: 36px; -moz-border-radius: 36px; border-radius: 36px; } diff --git a/js/jquery.mobile.forms.select.custom.js b/js/jquery.mobile.forms.select.custom.js index 6ea56b51..f0fea3eb 100644 --- a/js/jquery.mobile.forms.select.custom.js +++ b/js/jquery.mobile.forms.select.custom.js @@ -311,9 +311,8 @@ define( [ menuHeight = self.list.parent().outerHeight(), menuWidth = self.list.parent().outerWidth(), activePage = $( ".ui-page-active" ), - tOverflow = $.support.touchOverflow && $.mobile.touchOverflowEnabled, - tScrollElem = activePage.is( ".ui-native-fixed" ) ? activePage.find( ".ui-content" ) : activePage, - scrollTop = tOverflow ? tScrollElem.scrollTop() : $( window ).scrollTop(), + tScrollElem = activePage, + scrollTop = ( window ).scrollTop(), btnOffset = self.button.offset().top, screenHeight = $(window).height(), screenWidth = $(window).width(); diff --git a/js/jquery.mobile.init.js b/js/jquery.mobile.init.js index f4dcb347..2a525b59 100644 --- a/js/jquery.mobile.init.js +++ b/js/jquery.mobile.init.js @@ -126,24 +126,6 @@ define( [ "jquery", "jquery.mobile.core", "jquery.mobile.navigation", "jquery.mo } }); - // This function injects a meta viewport tag to prevent scaling. Off by default, on by default when touchOverflow scrolling is enabled - function disableZoom() { - var cont = "user-scalable=no", - meta = $( "meta[name='viewport']" ); - - if( meta.length ){ - meta.attr( "content", meta.attr( "content" ) + ", " + cont ); - } - else{ - $( "head" ).prepend( "", { "name": "viewport", "content": cont } ); - } - } - - // if touch-overflow is enabled, disable user scaling, as it creates usability issues - if( $.support.touchOverflow && $.mobile.touchOverflowEnabled && !$.mobile.touchOverflowZoomEnabled ){ - disableZoom(); - } - // initialize events now, after mobileinit has occurred $.mobile._registerInternalEvents(); diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js index bc277b1d..d6f04d4a 100755 --- a/js/jquery.mobile.navigation.js +++ b/js/jquery.mobile.navigation.js @@ -406,21 +406,9 @@ define( [ // Save the last scroll distance per page, before it is hidden var setLastScrollEnabled = true, - firstScrollElem, getScrollElem, setLastScroll, delayedSetLastScroll; + setLastScroll, delayedSetLastScroll; - getScrollElem = function() { - var scrollElem = $window, activePage, - touchOverflow = $.support.touchOverflow && $.mobile.touchOverflowEnabled; - - if( touchOverflow ){ - activePage = $( ".ui-page-active" ); - scrollElem = activePage.is( ".ui-native-fixed" ) ? activePage.find( ".ui-content" ) : activePage; - } - - return scrollElem; - }; - - setLastScroll = function( scrollElem ) { + setLastScroll = function() { // this barrier prevents setting the scroll value based on the browser // scrolling the window based on a hashchange if( !setLastScrollEnabled ) { @@ -430,7 +418,7 @@ define( [ var active = $.mobile.urlHistory.getActive(); if( active ) { - var lastScroll = scrollElem && scrollElem.scrollTop(); + var lastScroll = $window.scrollTop(); // Set active page's lastScroll prop. // If the location we're scrolling to is less than minScrollBack, let it go. @@ -443,7 +431,7 @@ define( [ // to the hash targets location (sometimes the top of the page). once pagechange fires // getLastScroll is again permitted to operate delayedSetLastScroll = function() { - setTimeout( setLastScroll, 100, $(this) ); + setTimeout( setLastScroll, 100 ); }; // disable an scroll setting when a hashchange has been fired, this only works @@ -462,23 +450,22 @@ define( [ $window.one( "pagecontainercreate", function(){ // once the page has changed, re-enable the scroll recording $.mobile.pageContainer.bind( "pagechange", function() { - var scrollElem = getScrollElem(); setLastScrollEnabled = true; // remove any binding that previously existed on the get scroll // which may or may not be different than the scroll element determined for // this page previously - scrollElem.unbind( "scrollstop", delayedSetLastScroll ); + $window.unbind( "scrollstop", delayedSetLastScroll ); // determine and bind to the current scoll element which may be the window // or in the case of touch overflow the element with touch overflow - scrollElem.bind( "scrollstop", delayedSetLastScroll ); + $window.bind( "scrollstop", delayedSetLastScroll ); }); }); // bind to scrollstop for the first page as "pagechange" won't be fired in that case - getScrollElem().bind( "scrollstop", delayedSetLastScroll ); + $window.bind( "scrollstop", delayedSetLastScroll ); //function for transitioning between two existing pages function transitionPages( toPage, fromPage, transition, reverse ) { @@ -529,10 +516,6 @@ define( [ //simply set the active page's minimum height to screen height, depending on orientation function resetActivePageHeight(){ - // Don't apply this height in touch overflow enabled mode - if( $.support.touchOverflow && $.mobile.touchOverflowEnabled ){ - return; - } $( "." + $.mobile.activePageClass ).css( "min-height", getScreenHeight() ); } diff --git a/js/jquery.mobile.transition.js b/js/jquery.mobile.transition.js index f0285bf3..1d292491 100644 --- a/js/jquery.mobile.transition.js +++ b/js/jquery.mobile.transition.js @@ -17,8 +17,7 @@ function outInTransitionHandler( name, reverse, $to, $from ) { var deferred = new $.Deferred(), reverseClass = reverse ? " reverse" : "", active = $.mobile.urlHistory.getActive(), - touchOverflow = $.support.touchOverflow && $.mobile.touchOverflowEnabled, - toScroll = active.lastScroll || ( touchOverflow ? 0 : $.mobile.defaultHomeScroll ), + toScroll = active.lastScroll || $.mobile.defaultHomeScroll, screenHeight = $.mobile.getScreenHeight(), viewportClass = "ui-mobile-viewport-transitioning viewport-" + name, maxTransitionOverride = $.mobile.maxTransitionWidth !== false && $( window ).width() > $.mobile.maxTransitionWidth, @@ -40,23 +39,10 @@ function outInTransitionHandler( name, reverse, $to, $from ) { // Send focus to page as it is now display: block $.mobile.focusPage( $to ); - if( touchOverflow && toScroll ){ - - //set page's scrollTop to remembered distance - if( $to.is( ".ui-native-fixed" ) ){ - $to.find( ".ui-content" ).scrollTop( toScroll ); - } - else{ - $to.scrollTop( toScroll ); - } - } - // Jump to top or prev scroll, sometimes on iOS the page has not rendered yet. - if( !touchOverflow ){ - $to.height( screenHeight + toScroll ); + $to.height( screenHeight + toScroll ); - $.mobile.silentScroll( toScroll ); - } + $.mobile.silentScroll( toScroll ); $to.addClass( name + " in" + reverseClass );