sliptree / bootstrap-tokenfield

A jQuery tag/token input plugin for Twitter's Bootstrap, by the guys from Sliptree
http://sliptree.github.io/bootstrap-tokenfield/
Other
859 stars 238 forks source link

Compatibility to jquery 1.8.x ? #333

Open pjfsilva opened 6 years ago

pjfsilva commented 6 years ago

Anyone tried to modify this script to work on jQuery 1.8.2 or older?

Right now I noticed the plugin doesn't work very well when using the backspace to delete since the order of focus() and blur() seems to be switched than when using jQuery 1.9. (I haven't found what the change in 1.9 that causes this)

Yes, I'm aware 1.8.x is not recommend and very old but still, it seems the plugin doesn't need many changes to work in older versions.

Right now the changes I noticed are required are related to calls to .focus and/or .blur. For example a call to l721 'this.$copyHelper.focus()' should be preceded by 'this.$input.blur();' to fix the wrong order issue.

mickelsonmichael commented 6 years ago

I ran into this issue as well. While backspacing, blur would be called after focus, which removes the focus class from the surrounding div.tokenfield.

For now the quickest/easiest solution is to import jQuery Migrate. Long-term it would be good to update to at least jQuery 1.9, but I know that isn't necessarily an easy feat.