This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
Prevents pillbox double insert in IE 11/Edge 14 #2023
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2022
In IE11, the hide of $addItem causes on focusout event to be triggered. With the checks in this function it determines that:
A) If a focusout event has occurred
and B) There is text in the input box
then it should add a pillbox. Since the hide triggers a focusout event in IE11, entering text and pressing enter will get you to this line. It will then hide the item, triggering a blur event. Since the item still has text, the blur event will add it to the pillbox, then the enter event will also add it to the pillbox causing it to be double entered.
Setting the value to blank before hiding causes condition B to be invalidated whenever the function is called for the focusout event.
NOTE: No unit test was written for this as fuelux does not appear to contain a spy library such as sinon to evaluate that the val function is called before the hide function. Similarly, the behaviour in IE11 cannot be validated via unit test.