From f15af45c6eb7d977923c339d686023e1ce4d011c Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sat, 20 Jun 2020 19:00:53 +0300 Subject: [PATCH] Unbreak lines. --- js/src/alert.js | 3 +-- js/src/carousel.js | 41 ++++++++++++++++--------------------- js/src/dom/event-handler.js | 2 ++ js/src/dropdown.js | 6 ++---- js/src/scrollspy.js | 41 +++++++++++++++++-------------------- js/src/toast.js | 7 +------ js/src/tooltip.js | 11 +++++----- 7 files changed, 48 insertions(+), 63 deletions(-) diff --git a/js/src/alert.js b/js/src/alert.js index bc0edc6c0e..324dc700a5 100644 --- a/js/src/alert.js +++ b/js/src/alert.js @@ -144,8 +144,7 @@ class Alert { * Data Api implementation * ------------------------------------------------------------------------ */ -EventHandler - .on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert())) +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert())) const $ = getjQuery() diff --git a/js/src/carousel.js b/js/src/carousel.js index 58382f6e25..b40410cd7e 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -263,15 +263,12 @@ class Carousel { _addEventListeners() { if (this._config.keyboard) { - EventHandler - .on(this._element, EVENT_KEYDOWN, event => this._keydown(event)) + EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event)) } if (this._config.pause === 'hover') { - EventHandler - .on(this._element, EVENT_MOUSEENTER, event => this.pause(event)) - EventHandler - .on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event)) + EventHandler.on(this._element, EVENT_MOUSEENTER, event => this.pause(event)) + EventHandler.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event)) } if (this._config.touch && this._touchSupported) { @@ -476,24 +473,23 @@ class Carousel { const transitionDuration = getTransitionDurationFromElement(activeElement) - EventHandler - .one(activeElement, TRANSITION_END, () => { - nextElement.classList.remove(directionalClassName, orderClassName) - nextElement.classList.add(CLASS_NAME_ACTIVE) + EventHandler.one(activeElement, TRANSITION_END, () => { + nextElement.classList.remove(directionalClassName, orderClassName) + nextElement.classList.add(CLASS_NAME_ACTIVE) - activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName) + activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName) - this._isSliding = false + this._isSliding = false - setTimeout(() => { - EventHandler.trigger(this._element, EVENT_SLID, { - relatedTarget: nextElement, - direction: eventDirectionName, - from: activeElementIndex, - to: nextElementIndex - }) - }, 0) - }) + setTimeout(() => { + EventHandler.trigger(this._element, EVENT_SLID, { + relatedTarget: nextElement, + direction: eventDirectionName, + from: activeElementIndex, + to: nextElementIndex + }) + }, 0) + }) emulateTransitionEnd(activeElement, transitionDuration) } else { @@ -593,8 +589,7 @@ class Carousel { * ------------------------------------------------------------------------ */ -EventHandler - .on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler) +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler) EventHandler.on(window, EVENT_LOAD_DATA_API, () => { const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE) diff --git a/js/src/dom/event-handler.js b/js/src/dom/event-handler.js index 5fea030182..e909805f0a 100644 --- a/js/src/dom/event-handler.js +++ b/js/src/dom/event-handler.js @@ -95,6 +95,7 @@ function getEvent(element) { function bootstrapHandler(element, fn) { return function handler(event) { event.delegateTarget = element + if (handler.oneOff) { EventHandler.off(element, event.type, fn) } @@ -111,6 +112,7 @@ function bootstrapDelegationHandler(element, selector, fn) { for (let i = domElements.length; i--;) { if (domElements[i] === target) { event.delegateTarget = target + if (handler.oneOff) { EventHandler.off(element, event.type, fn) } diff --git a/js/src/dropdown.js b/js/src/dropdown.js index 42137a1937..539f9e7a44 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -468,8 +468,7 @@ class Dropdown { return } - const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent) - .filter(isVisible) + const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible) if (!items.length) { return @@ -511,8 +510,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function ( event.stopPropagation() Dropdown.dropdownInterface(this, 'toggle') }) -EventHandler - .on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, e => e.stopPropagation()) +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, e => e.stopPropagation()) const $ = getjQuery() diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index 90e03b0007..9156223111 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -118,27 +118,26 @@ class ScrollSpy { const targets = SelectorEngine.find(this._selector) - targets - .map(element => { - let target - const targetSelector = getSelectorFromElement(element) + targets.map(element => { + let target + const targetSelector = getSelectorFromElement(element) - if (targetSelector) { - target = SelectorEngine.findOne(targetSelector) + if (targetSelector) { + target = SelectorEngine.findOne(targetSelector) + } + + if (target) { + const targetBCR = target.getBoundingClientRect() + if (targetBCR.width || targetBCR.height) { + return [ + Manipulator[offsetMethod](target).top + offsetBase, + targetSelector + ] } + } - if (target) { - const targetBCR = target.getBoundingClientRect() - if (targetBCR.width || targetBCR.height) { - return [ - Manipulator[offsetMethod](target).top + offsetBase, - targetSelector - ] - } - } - - return null - }) + return null + }) .filter(item => item) .sort((a, b) => a[0] - b[0]) .forEach(item => { @@ -253,8 +252,7 @@ class ScrollSpy { const link = SelectorEngine.findOne(queries.join(',')) if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { - SelectorEngine - .findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)) + SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)) .classList.add(CLASS_NAME_ACTIVE) link.classList.add(CLASS_NAME_ACTIVE) @@ -262,8 +260,7 @@ class ScrollSpy { // Set triggered link as active link.classList.add(CLASS_NAME_ACTIVE) - SelectorEngine - .parents(link, SELECTOR_NAV_LIST_GROUP) + SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP) .forEach(listGroup => { // Set triggered links parents as active // With both