Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 48139f8

Browse files
committed
Autogrow: fix height calculation to account for borders Fixes #6180 - Autogrow: calculated height contains border height and Fixes #6178 - Textinput: height not correctly calculated due to box-sizing thanks @jhogervorst
1 parent 4ab19a7 commit 48139f8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

js/widgets/forms/autogrow.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,15 @@ define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", ".
5858

5959
_updateHeight:function() {
6060

61-
this.element.css({
62-
height: "auto"
63-
}).css({
64-
height: this.element[0].scrollHeight + 15 + "px"
65-
});
66-
61+
this.element.css( "height", "auto" );
62+
63+
var scrollHeight = this.element[0].scrollHeight,
64+
borderTop = parseFloat( this.element.css( "border-top-width" ) ),
65+
borderBottom = parseFloat( this.element.css( "border-bottom-width" ) ),
66+
borderHeight = borderTop + borderBottom,
67+
height = scrollHeight + borderHeight + 15;
68+
69+
this.element.css( "height", height + "px" );
6770
},
6871

6972
_setOptions: function( options ){

0 commit comments

Comments
 (0)