Permalink
Browse files

(W-3550658) Makes boolean check a little more redible

  • Loading branch information...
1 parent 7f355bf commit 1cc13bad358a1e907f7e0677b3bac0b2d0785013 @cormacmccarthy cormacmccarthy committed Dec 12, 2016
Showing with 4 additions and 3 deletions.
  1. +4 −3 js/pillbox.js
View
@@ -357,11 +357,12 @@
var self = this;
var text = self.options.cleanInput(this.$addItem.val());
var isFocusOutEvent = e.type === 'focusout';
- var addOnFocusOut = (isFocusOutEvent && text.length > 0);
-
+ var blurredAfterInput = (isFocusOutEvent && text.length > 0);
// If we test for keycode only, it will match for `<` & `,` instead of just `,`
// This way users can type `<3` and `1 < 3`, etc...
- if ((this.acceptKeyCodes[e.keyCode] && !isShiftHeld(e)) || addOnFocusOut) {
+ var acceptKeyPressed = (this.acceptKeyCodes[e.keyCode] && !isShiftHeld(e));
+
+ if (acceptKeyPressed || blurredAfterInput) {
var attr;
var value;

0 comments on commit 1cc13ba

Please sign in to comment.