mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-17 13:06:34 +02:00
Remove assignment within if
This commit is contained in:
parent
bfef79d3ee
commit
e16ddb404f
|
@ -1,6 +1,6 @@
|
||||||
import Fuse from 'fuse.js';
|
import Fuse from 'fuse.js';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import Store from './store/index.js';
|
import Store from './store/index';
|
||||||
import {
|
import {
|
||||||
addItem,
|
addItem,
|
||||||
removeItem,
|
removeItem,
|
||||||
|
@ -1875,16 +1875,19 @@ class Choices {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.containerOuter.contains(target) && target !== this.input) {
|
if (this.containerOuter.contains(target) && target !== this.input) {
|
||||||
let foundTarget;
|
|
||||||
const activeItems = this.store.getItemsFilteredByActive();
|
const activeItems = this.store.getItemsFilteredByActive();
|
||||||
const hasShiftKey = e.shiftKey;
|
const hasShiftKey = e.shiftKey;
|
||||||
|
|
||||||
if (foundTarget = findAncestorByAttrName(target, 'data-button')) {
|
const buttonTarget = findAncestorByAttrName(target, 'data-button');
|
||||||
this._handleButtonAction(activeItems, foundTarget);
|
const itemTarget = findAncestorByAttrName(target, 'data-item');
|
||||||
} else if (foundTarget = findAncestorByAttrName(target, 'data-item')) {
|
const choiceTarget = findAncestorByAttrName(target, 'data-choice');
|
||||||
this._handleItemAction(activeItems, foundTarget, hasShiftKey);
|
|
||||||
} else if (foundTarget = findAncestorByAttrName(target, 'data-choice')) {
|
if (buttonTarget) {
|
||||||
this._handleChoiceAction(activeItems, foundTarget);
|
this._handleButtonAction(activeItems, buttonTarget);
|
||||||
|
} else if (itemTarget) {
|
||||||
|
this._handleItemAction(activeItems, itemTarget, hasShiftKey);
|
||||||
|
} else if (choiceTarget) {
|
||||||
|
this._handleChoiceAction(activeItems, choiceTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
Loading…
Reference in a new issue