Skip to content

Commit

Permalink
More
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Nov 16, 2021
1 parent 41a562a commit c48f6e4
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions js/src/carousel.js
Expand Up @@ -278,7 +278,7 @@ class Carousel extends BaseComponent {
}

_getItemIndex(element) {
this._items = element && element.parentNode ?
this._items = element?.parentNode ?
SelectorEngine.find(SELECTOR_ITEM, element.parentNode) :
[]

Expand Down Expand Up @@ -354,7 +354,7 @@ class Carousel extends BaseComponent {
const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV
const eventDirectionName = this._orderToDirection(order)

if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {
if (nextElement?.classList.contains(CLASS_NAME_ACTIVE)) {
this._isSliding = false
return
}
Expand Down
2 changes: 1 addition & 1 deletion js/src/collapse.js
Expand Up @@ -284,7 +284,7 @@ class Collapse extends BaseComponent {

EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
if (event.target.tagName === 'A' || (event.delegateTarget && event.delegateTarget.tagName === 'A')) {
if (event.target.tagName === 'A' || event.delegateTarget?.tagName === 'A') {
event.preventDefault()
}

Expand Down
2 changes: 1 addition & 1 deletion js/src/dom/selector-engine.js
Expand Up @@ -30,7 +30,7 @@ const SelectorEngine = {
const parents = []
let ancestor = element.parentNode

while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
while (ancestor?.nodeType === Node.ELEMENT_NODE && ancestor?.nodeType !== NODE_TEXT) {
if (ancestor.matches(selector)) {
parents.push(ancestor)
}
Expand Down
2 changes: 1 addition & 1 deletion js/src/dropdown.js
Expand Up @@ -363,7 +363,7 @@ class Dropdown extends BaseComponent {
}

static clearMenus(event) {
if (event && (event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY))) {
if (event?.button === RIGHT_MOUSE_BUTTON || (event?.type === 'keyup' && event?.key !== TAB_KEY)) {
return
}

Expand Down
6 changes: 3 additions & 3 deletions js/src/tab.js
Expand Up @@ -102,7 +102,7 @@ class Tab extends BaseComponent {
SelectorEngine.children(container, SELECTOR_ACTIVE)

const active = activeElements[0]
const isTransitioning = callback && (active && active.classList.contains(CLASS_NAME_FADE))
const isTransitioning = callback && (active?.classList.contains(CLASS_NAME_FADE))

const complete = () => this._transitionComplete(element, active, callback)

Expand Down Expand Up @@ -141,11 +141,11 @@ class Tab extends BaseComponent {
}

let parent = element.parentNode
if (parent && parent.nodeName === 'LI') {
if (parent?.nodeName === 'LI') {
parent = parent.parentNode
}

if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
if (parent?.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
const dropdownElement = element.closest(SELECTOR_DROPDOWN)

if (dropdownElement) {
Expand Down
2 changes: 1 addition & 1 deletion js/src/util/swipe.js
Expand Up @@ -82,7 +82,7 @@ class Swipe {
}

_move(event) {
this._deltaX = event.touches && event.touches.length > 1 ?
this._deltaX = event.touches?.length > 1 ?
0 :
event.touches[0].clientX - this._deltaX
}
Expand Down

0 comments on commit c48f6e4

Please sign in to comment.