jQuery-Tagit icon indicating copy to clipboard operation
jQuery-Tagit copied to clipboard

Bug: clicking in input and going to another page results in js error

Open tonnyavery opened this issue 13 years ago • 3 comments

If you click in any tagit input are then try to visit another page you get: Uncaught Error: cannot call methods on autocomplete prior to initialization; attempted to call method 'close' jquery.min.js:2

Problem is that in input blur timer is set for 400ms, which then calls _addTag. When we visit another page DOM changes autocomplete instance is removed, so attempt to all this.input.autocomplete('close').val(""); results in an error.

Solution would be to bind window.blur or hashchange and add clearTimeout and all 'destructor' routine of the plugin. I will implement local workaround for now.

tonnyavery avatar Nov 16 '12 05:11 tonnyavery

nwm. adding clearTimeout(self.timer) to destroy function solves the problem completely. I'll commit the fix to my fork and maybe make another pull request, which probably wouldn't be merged for along time=)

tonnyavery avatar Nov 16 '12 06:11 tonnyavery

I'm hoping to get them merged this week. Just busy with paid work atm and I like to review all changes before Imerge properly! On Nov 16, 2012 7:19 PM, "AAverin" [email protected] wrote:

nwm. adding clearTimeout(self.timer) to destroy function solves the problem completely. I'll commit the fix to my fork and maybe make another pull request, which probably wouldn't be merged for along time=)

— Reply to this email directly or view it on GitHubhttps://github.com/hailwood/jQuery-Tagit/issues/61#issuecomment-10437788.

hailwood avatar Nov 16 '12 06:11 hailwood

Great, thanks. I'm not sure how to edit pull request and add commits to them on github (new here), so I'll probably delete the current one and make a new with all fixes implemented. Feel free to make any changes you may find appropriate to my code=)

tonnyavery avatar Nov 16 '12 06:11 tonnyavery