Skip to content
This repository
Browse code

refactor for #509, move to document ready instead of using ssetTimeout

  • Loading branch information...
commit 8dd3def54b28b57432f893ef008e6ebb045f4b30 1 parent 3306a32
John Bender johnbender authored

Showing 1 changed file with 7 additions and 5 deletions. Show diff stats Hide diff stats

  1. +7 5 js/jquery.mobile.forms.textinput.js
12 js/jquery.mobile.forms.textinput.js
@@ -100,6 +100,9 @@ $.widget( "mobile.textinput", $.mobile.widget, {
100 100 var scrollHeight = input[ 0 ].scrollHeight,
101 101 clientHeight = input[ 0 ].clientHeight;
102 102
  103 + console.log( scrollHeight );
  104 + console.log( clientHeight );
  105 +
103 106 if ( clientHeight < scrollHeight ) {
104 107 input.css({
105 108 height: (scrollHeight + extraLineHeight)
@@ -112,12 +115,11 @@ $.widget( "mobile.textinput", $.mobile.widget, {
112 115 clearTimeout( keyupTimeout );
113 116 keyupTimeout = setTimeout( keyup, keyupTimeoutBuffer );
114 117 });
115   - // Issue 509: the browser is not giving scrollHeight properly until after this function has run, adding in a setTimeout
116   - // so we can properly access the scrollHeight
  118 +
  119 + // Issue 509: the browser is not giving scrollHeight properly until after the document
  120 + // is ready.
117 121 if ($.trim(input.text())) {
118   - setTimeout( function() {
119   - keyup();
120   - }, 0 );
  122 + $(keyup);
121 123 }
122 124 }
123 125 },

0 comments on commit 8dd3def

Please sign in to comment.
Something went wrong with that request. Please try again.