Skip to content

Wrapped createTag method to flag is creation is in progress, and watch for this in the blur event #147

Open
wants to merge 2 commits into from

3 participants

@robertprice

I have wrapped the createTag method so it flags if creation of a tag is in place, and when create the flag is removed. I look for this tag in the blur event and don't try to create the tag again if the flag is set.

This fixes a bug I had in Firefox where I was using a confirm() dialog in a beforeTagAdded event handler. Calling confirm() in firefox causes the field to loose focus triggering the blur event. This meant it called createTag twice for a tag in this situation. Adding the flag when creating a tag, and checking for it in the blur event handler catches this condition.

robertprice added some commits Feb 11, 2013
@robertprice robertprice wrapped the createTag method to flag if a tag is in the process of be…
…ing created, we also check for this in the blur event to make sure we don't doubley create the tag
cbd1adb
@robertprice robertprice update tag-it.min.js 2d8ec09
@robertprice

Wrapped the createTag method so it flags if it is in the process of creating a tag already. I then check for this in the blur() event handler so if a tag is already in the process of being created it won't try to create again.

This fixes an issue I had using a confirm() dialog in a beforeTagAdded event handler. I was using confirm to get the user to confirm if the tag really should be added. On Firefox, calling confirm triggers causes the field to loose focus and triggers a blur event and caused it to try to add the tag twice.

@aehlke aehlke was assigned Mar 5, 2013
@jrwdunham

I was having the same issue: using a jQuery dialog widget to confirm creation of a new tag and that causing a blur event which was resulting in duplicate tags. I used robertprice's changes and they seem to be fixing the problem...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.