bgrins / ExpandingTextareas

jQuery plugin for elegant expanding textareas
http://bgrins.github.com/ExpandingTextareas/
MIT License
261 stars 73 forks source link

Improve update #68

Open domchristie opened 7 years ago

domchristie commented 7 years ago

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.

bgrins commented 7 years ago

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

bgrins commented 7 years ago

Looks fine to me if you are OK with https://github.com/bgrins/ExpandingTextareas/pull/68#issuecomment-258918552

domchristie commented 7 years ago

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.