Showing with 19 additions and 36 deletions.
  1. +8 −16 js/widgets/fixedToolbar.backcompat.js
  2. +5 −16 js/widgets/fixedToolbar.js
  3. +2 −1 js/widgets/fixedToolbar.tapToggle.js
  4. +4 −3 js/widgets/toolbar.js
@@ -158,9 +158,9 @@ if ( $.mobileBackcompat !== false ) {
// -webkit-transform:translate3d(0,0,0); solves this problem to avoid potential issues in
// other platforms we scope this with the class ui-android-2x-fix
_bindListThumbWorkaround: function() {
var pageActive = $( ".ui-page-active" ),
var pageActive = this.document.find( ".ui-page-active" ),
currentPage = !!this.page ? this.page : pageActive.length ?
pageActive : $( ".ui-page" ).eq( 0 );
pageActive : this.document.find( ".ui-page" ).eq( 0 );
this._addClass( currentPage, "ui-toolbar-android-2x-fix" );
},

@@ -170,28 +170,20 @@ if ( $.mobileBackcompat !== false ) {
// adding 1px of padding to the bottom then removing it causes a "redraw"
// which positions the toolbars correctly (they will always be visually correct)
_triggerRedraw: function() {
var paddingBottom = parseFloat( $( ".ui-page-active" ).css( "padding-bottom" ) );
var paddingBottom = parseFloat( this.document.find( ".ui-page-active" )
.css( "padding-bottom" ) );

//Trigger page redraw to fix incorrectly positioned fixed elements
$( ".ui-page-active" ).css( "padding-bottom", ( paddingBottom + 1 ) + "px" );
this.document.find( ".ui-page-active" )
.css( "padding-bottom", ( paddingBottom + 1 ) + "px" );

//If the padding is reset with out a timeout the reposition will not occure.
//this is independent of JQM the browser seems to need the time to react.
setTimeout( function() {
$( ".ui-page-active" ).css( "padding-bottom", paddingBottom + "px" );
this.document.find( ".ui-page-active" )
.css( "padding-bottom", paddingBottom + "px" );
}, 0 );
},

destroy: function() {
this._super();
var pageActive = $( ".ui-page-active" ),
currentPage = !!this.page ? this.page : pageActive.length ?
pageActive : $( ".ui-page" ).eq( 0 );

//Remove the class we added to the page previously in android 2.x
this._removeClass( currentPage, "ui-toolbar-android-2x-fix" );
}

} );

}
@@ -67,12 +67,12 @@ return $.widget( "mobile.toolbar", $.mobile.toolbar, {
this._makeFixed();
}
if ( this.options.position === "fixed" ) {
var pageActive = $( ".ui-page-active" ),
var pageActive = this.document.find( ".ui-page-active" ),
currentPage = !!this.page ?
this.page :
pageActive.length ?
pageActive :
$( ".ui-page" ).eq( 0 );
this.document.find( ".ui-page" ).eq( 0 );
if ( o.fullscreen !== undefined ) {
if ( o.fullscreen ) {
this._addClass( "ui-toolbar-" + this.role + "-fullscreen" );
@@ -177,7 +177,7 @@ return $.widget( "mobile.toolbar", $.mobile.toolbar, {
scroll = $win.scrollTop(),
elHeight = $el.height(),
pHeight = ( !!this.page ) ? $el.closest( ".ui-page" ).height() :
$( ".ui-page-active" ).height(),
this.document.find( ".ui-page-active" ).height(),
viewportHeight = $( window ).height();

return !notransition &&
@@ -244,29 +244,18 @@ return $.widget( "mobile.toolbar", $.mobile.toolbar, {
},

_destroy: function() {
var pageClasses, toolbarClasses, hasFixed, header, hasFullscreen,
var hasFixed, header,
page = this.pagecontainer.pagecontainer( "getActivePage" );

this._super();
if ( this.options.position === "fixed" ) {
hasFixed = $( "body>.ui-" + this.role + "-fixed" )
hasFixed = this.document.find( "body>.ui-" + this.role + "-fixed" )
.add( page.find( ".ui-" + this.role + "-fixed" ) )
.not( this.element ).length > 0;
hasFullscreen = $( "body>.ui-" + this.role + "-fixed" )
.add( page.find( ".ui-" + this.role + "-fullscreen" ) )
.not( this.element ).length > 0;
toolbarClasses = "ui-header-fixed ui-footer-fixed ui-header-fullscreen in out" +
" ui-footer-fullscreen fade slidedown slideup ui-fixed-hidden";
this._removeClass( toolbarClasses );
if ( !hasFullscreen ) {
pageClasses = "ui-page-" + this.role + "-fullscreen";
}
if ( !hasFixed ) {
header = this.role === "header";
pageClasses += " ui-page-" + this.role + "-fixed";
page.css( "padding-" + ( header ? "top" : "bottom" ), "" );
}
this._removeClass( page, pageClasses );
}
}

@@ -46,7 +46,8 @@ return $.widget( "mobile.toolbar", $.mobile.toolbar, {
},

_bindToggleHandlers: function() {
this._attachToggleHandlersToPage( ( !!this.page ) ? this.page : $( ".ui-page" ) );
this._attachToggleHandlersToPage( ( !!this.page ) ? this.page :
this.document.find( ".ui-page" ) );
},

_attachToggleHandlersToPage: function( page ) {
@@ -57,7 +57,7 @@ $.widget( "mobile.toolbar", {
if ( page.length === 0 ) {
page = false;
this._on( this.document, {
"pageshow": "refresh"
"pagecontainershow": "refresh"
} );
}
$.extend( this, {
@@ -96,7 +96,8 @@ $.widget( "mobile.toolbar", {

//We only want this to run on non fixed toolbars so make it easy to override
_setRelative: function() {
$( "[data-" + $.mobile.ns + "role='page']" ).css( { "position": "relative" } );
this.document.find( "[data-" + $.mobile.ns + "role='page']" )
.css( { "position": "relative" } );
},

_updateBackButton: function() {
@@ -114,7 +115,7 @@ $.widget( "mobile.toolbar", {
this.role === "header" &&

// There must be multiple pages in the DOM
$( ".ui-page" ).length > 1 &&
this.document.find( ".ui-page" ).length > 1 &&
( this.page ?

// If the toolbar is internal the page's URL must differ from the hash