Permalink
Browse files

Autogrow: adds padding omitted from clientHeight by Firefox. Fixes #6179

 - Textinput: height not correctly calculated in Firefox
  • Loading branch information...
jhogervorst authored and arschmitz committed Aug 6, 2013
1 parent 4692895 commit b4d51581bb245e409ed6a2925f2716613bd29d64
Showing with 18 additions and 2 deletions.
  1. +18 −2 js/widgets/forms/autogrow.js
@@ -58,14 +58,30 @@ define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", ".
_updateHeight:function() {
this.element.css( "height", "auto" );
this.element.css( "height", "0px" );
var scrollHeight = this.element[0].scrollHeight,
var paddingTop, paddingBottom, paddingHeight,
scrollHeight = this.element[ 0 ].scrollHeight,
clientHeight = this.element[ 0 ].clientHeight,
borderTop = parseFloat( this.element.css( "border-top-width" ) ),
borderBottom = parseFloat( this.element.css( "border-bottom-width" ) ),
borderHeight = borderTop + borderBottom,
height = scrollHeight + borderHeight + 15;
// Issue 6179: Padding is not included in scrollHeight and
// clientHeight by Firefox if no scrollbar is visible. Because
// textareas use the border-box box-sizing model, padding should be
// included in the new (assigned) height. Because the height is set
// to 0, clientHeight == 0 in Firefox. Therefore, we can use this to
// check if padding must be added.
if ( clientHeight === 0 ) {
paddingTop = parseFloat( this.element.css( "padding-top" ) );
paddingBottom = parseFloat( this.element.css( "padding-bottom" ) );
paddingHeight = paddingTop + paddingBottom;
height += paddingHeight;
}
this.element.css( "height", height + "px" );
},

0 comments on commit b4d5158

Please sign in to comment.