From 8dd3def54b28b57432f893ef008e6ebb045f4b30 Mon Sep 17 00:00:00 2001 From: John Bender Date: Tue, 11 Oct 2011 10:46:19 -0700 Subject: [PATCH] refactor for #509, move to document ready instead of using ssetTimeout --- js/jquery.mobile.forms.textinput.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/js/jquery.mobile.forms.textinput.js b/js/jquery.mobile.forms.textinput.js index 8a79623b..da252296 100644 --- a/js/jquery.mobile.forms.textinput.js +++ b/js/jquery.mobile.forms.textinput.js @@ -100,6 +100,9 @@ $.widget( "mobile.textinput", $.mobile.widget, { var scrollHeight = input[ 0 ].scrollHeight, clientHeight = input[ 0 ].clientHeight; + console.log( scrollHeight ); + console.log( clientHeight ); + if ( clientHeight < scrollHeight ) { input.css({ height: (scrollHeight + extraLineHeight) @@ -112,12 +115,11 @@ $.widget( "mobile.textinput", $.mobile.widget, { clearTimeout( keyupTimeout ); keyupTimeout = setTimeout( keyup, keyupTimeoutBuffer ); }); - // Issue 509: the browser is not giving scrollHeight properly until after this function has run, adding in a setTimeout - // so we can properly access the scrollHeight + + // Issue 509: the browser is not giving scrollHeight properly until after the document + // is ready. if ($.trim(input.text())) { - setTimeout( function() { - keyup(); - }, 0 ); + $(keyup); } } },