Skip to content

Commit

Permalink
Toolbar: removing popup removes page-header-fixed class
Browse files Browse the repository at this point in the history
  • Loading branch information
cgack committed Aug 28, 2014
1 parent 2a90b14 commit f7fefb9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
14 changes: 4 additions & 10 deletions js/widgets/fixedToolbar.js
Expand Up @@ -277,28 +277,22 @@ define( [ "jquery", "../widget", "../core", "../animationComplete", "../navigati
},

_destroy: function() {
var pageClasses, toolbarClasses, header, hasFixedChildren,
var pageClasses, toolbarClasses, hasFixedChildren,
page = ( !!this.page ) ?
this.page : ( $( ".ui-page-active" ).length > 0 ) ?
$( ".ui-page-active" ) : $( ".ui-page" ).eq(0);


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

page.removeClass( pageClasses );
}
}
Expand Down
14 changes: 9 additions & 5 deletions js/widgets/toolbar.js
Expand Up @@ -115,12 +115,13 @@ define( [
var options = this.options,
theme = options.backBtnTheme || options.theme;

$( "<a role='button' href='javascript:void(0);' " +
this.backButton = $( "<a role='button' href='javascript:void(0);' " +
"class='ui-btn ui-corner-all ui-shadow ui-btn-left " +
( theme ? "ui-btn-" + theme + " " : "" ) +
"ui-toolbar-back-btn ui-icon-carat-l ui-btn-icon-left' " +
"data-" + $.mobile.ns + "rel='back'>" + options.backBtnText + "</a>" )
.prependTo( this.element );
"data-" + $.mobile.ns + "rel='back'>" + options.backBtnText + "</a>" );

this.backButton.prependTo( this.element );
},
_addHeadingClasses: function() {
this.element.children( "h1, h2, h3, h4, h5, h6" )
Expand All @@ -140,8 +141,11 @@ define( [
.removeAttr( "aria-level" );

if ( this.role === "header" ) {
this.element.children( "a, button" ).removeClass( "ui-btn-left ui-btn-right" );
this.element.find( ".ui-toolbar-back-btn" ).remove();
this.element.children( "a, button" )
.removeClass( "ui-btn-left ui-btn-right ui-btn ui-shadow ui-corner-all" );
if ( this.backButton ) {
this.backButton.remove();
}
}

if ( this.options.theme !== undefined ) {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/toolbar/index.html
Expand Up @@ -58,4 +58,4 @@ <h1>External Footer</h1>
</div>

</body>
</html>
</html>
2 changes: 1 addition & 1 deletion tests/unit/toolbar/toolbar_core.js
Expand Up @@ -87,4 +87,4 @@
ok( $.testHelper.domEqual( headerClone, unEnhancedHeader), "headers match after destroy" );
});

})(jQuery);
})(jQuery);

0 comments on commit f7fefb9

Please sign in to comment.