"always-multiline"
],
"new-cap": "off",
- "no-mixed-operators": "off",
+ "no-mixed-operators": "error",
"object-curly-spacing": [
"error",
"always"
if (rootElement) {
const input = SelectorEngine.findOne(Selector.INPUT, this._element)
- if (input) {
- if (input.type === 'radio') {
- if (input.checked &&
- this._element.classList.contains(ClassName.ACTIVE)) {
- triggerChangeEvent = false
- } else {
- const activeElement = SelectorEngine.findOne(Selector.ACTIVE, rootElement)
-
- if (activeElement) {
- activeElement.classList.remove(ClassName.ACTIVE)
- }
+ if (input && input.type === 'radio') {
+ if (input.checked &&
+ this._element.classList.contains(ClassName.ACTIVE)) {
+ triggerChangeEvent = false
+ } else {
+ const activeElement = SelectorEngine.findOne(Selector.ACTIVE, rootElement)
+
+ if (activeElement) {
+ activeElement.classList.remove(ClassName.ACTIVE)
}
}
const isPrevDirection = direction === Direction.PREV
const activeIndex = this._getItemIndex(activeElement)
const lastItemIndex = this._items.length - 1
- const isGoingToWrap = isPrevDirection && activeIndex === 0 ||
- isNextDirection && activeIndex === lastItemIndex
+ const isGoingToWrap = (isPrevDirection && activeIndex === 0) ||
+ (isNextDirection && activeIndex === lastItemIndex)
if (isGoingToWrap && !this._config.wrap) {
return activeElement
_slide(direction, element) {
const activeElement = SelectorEngine.findOne(Selector.ACTIVE_ITEM, this._element)
const activeElementIndex = this._getItemIndex(activeElement)
- const nextElement = element || activeElement &&
- this._getItemByDirection(direction, activeElement)
+ const nextElement = element || (activeElement &&
+ this._getItemByDirection(direction, activeElement))
const nextElementIndex = this._getItemIndex(nextElement)
const isCycling = Boolean(this._interval)
*/
function getUidEvent(element, uid) {
- return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++
+ return (uid && `${uid}::${uidEvent++}`) || element.uidEvent || uidEvent++
}
function getEvent(element) {
static clearMenus(event) {
if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH ||
- event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
+ (event.type === 'keyup' && event.which !== TAB_KEYCODE))) {
return
}
continue
}
- if (event && (event.type === 'click' &&
- /input|textarea/i.test(event.target.tagName) ||
- event.type === 'keyup' && event.which === TAB_KEYCODE) &&
+ if (event && ((event.type === 'click' &&
+ /input|textarea/i.test(event.target.tagName)) ||
+ (event.type === 'keyup' && event.which === TAB_KEYCODE)) &&
parent.contains(event.target)) {
continue
}
// - If key is not up or down => not a dropdown command
// - If trigger inside the menu => not a dropdown command
if (/input|textarea/i.test(event.target.tagName) ?
- event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE &&
- (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE ||
- SelectorEngine.closest(event.target, Selector.MENU)) :
+ event.which === SPACE_KEYCODE || (event.which !== ESCAPE_KEYCODE &&
+ ((event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE) ||
+ SelectorEngine.closest(event.target, Selector.MENU))) :
!REGEXP_KEYDOWN.test(event.which)) {
return
}
const parent = Dropdown.getParentFromElement(this)
const isActive = parent.classList.contains(ClassName.SHOW)
- if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
+ if (!isActive || (isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE))) {
if (event.which === ESCAPE_KEYCODE) {
SelectorEngine.findOne(Selector.DATA_TOGGLE, parent).focus()
}
// Public
show() {
- if (this._element.parentNode &&
+ if ((this._element.parentNode &&
this._element.parentNode.nodeType === Node.ELEMENT_NODE &&
- this._element.classList.contains(ClassName.ACTIVE) ||
+ this._element.classList.contains(ClassName.ACTIVE)) ||
this._element.classList.contains(ClassName.DISABLED)) {
return
}
})
if (showEvent.defaultPrevented ||
- hideEvent !== null && hideEvent.defaultPrevented) {
+ (hideEvent !== null && hideEvent.defaultPrevented)) {
return
}