ExpandingTextareas
ExpandingTextareas copied to clipboard
Improve update
Removes the unnecessary call to update the clone textarea on change, since it should already have updated on the input event. It also exposes the update method to the jQuery plugin, so that rather than accessing the Expanding instance and calling update:
$('textarea').data('expanding').update()
users can do:
$('textarea').expanding('update')
as is shown in the updated demo.
I thought there was some case on older browsers not supporting 'input' that change would capture cases where keyup didn't (maybe right click -> paste for instance). However, at this point I think we can assume it's available: http://caniuse.com/#feat=input-event
Looks fine to me if you are OK with https://github.com/bgrins/ExpandingTextareas/pull/68#issuecomment-258918552
I thought there was some case on older browsers not supporting 'input' that change would capture cases where keyup didn't (maybe right click -> paste for instance)
Good point: I have added a paste handler for browsers that do not support input.