From 52fdab8d70b3e3c080dd5a328ce1e92213f31c01 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 8 May 2020 10:21:04 +0300 Subject: [PATCH] Join/break a few lines, no functional changes --- js/src/carousel.js | 13 ++++++------- js/src/collapse.js | 5 ++--- js/src/scrollspy.js | 17 +++++++++++------ js/src/toast.js | 6 +----- js/src/tooltip.js | 17 +++-------------- js/src/util.js | 1 - 6 files changed, 23 insertions(+), 36 deletions(-) diff --git a/js/src/carousel.js b/js/src/carousel.js index 6d21a7f22d..7dc36ca023 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -251,8 +251,7 @@ class Carousel { _addEventListeners() { if (this._config.keyboard) { - $(this._element) - .on(EVENT_KEYDOWN, (event) => this._keydown(event)) + $(this._element).on(EVENT_KEYDOWN, (event) => this._keydown(event)) } if (this._config.pause === 'hover') { @@ -311,7 +310,9 @@ class Carousel { } } - $(this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, (e) => e.preventDefault()) + $(this._element.querySelectorAll(SELECTOR_ITEM_IMG)) + .on(EVENT_DRAG_START, (e) => e.preventDefault()) + if (this._pointerEvent) { $(this._element).on(EVENT_POINTERDOWN, (event) => start(event)) $(this._element).on(EVENT_POINTERUP, (event) => end(event)) @@ -386,8 +387,7 @@ class Carousel { _setActiveIndicatorElement(element) { if (this._indicatorsElement) { const indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE)) - $(indicators) - .removeClass(CLASS_NAME_ACTIVE) + $(indicators).removeClass(CLASS_NAME_ACTIVE) const nextIndicator = this._indicatorsElement.children[ this._getItemIndex(element) @@ -572,8 +572,7 @@ class Carousel { * ------------------------------------------------------------------------ */ -$(document) - .on(EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler) +$(document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler) $(window).on(EVENT_LOAD_DATA_API, () => { const carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE)) diff --git a/js/src/collapse.js b/js/src/collapse.js index 39fd62bccf..01880c104e 100644 --- a/js/src/collapse.js +++ b/js/src/collapse.js @@ -294,10 +294,9 @@ class Collapse { parent = document.querySelector(this._config.parent) } - const selector = - `[data-toggle="collapse"][data-parent="${this._config.parent}"]` - + const selector = `[data-toggle="collapse"][data-parent="${this._config.parent}"]` const children = [].slice.call(parent.querySelectorAll(selector)) + $(children).each((i, element) => { this._addAriaAndCollapsedClass( Collapse._getTargetFromElement(element), diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index bf546a2586..8506d8e05c 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -191,9 +191,7 @@ class ScrollSpy { _process() { const scrollTop = this._getScrollTop() + this._config.offset const scrollHeight = this._getScrollHeight() - const maxScroll = this._config.offset + - scrollHeight - - this._getOffsetHeight() + const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight() if (this._scrollHeight !== scrollHeight) { this.refresh() @@ -238,16 +236,23 @@ class ScrollSpy { const $link = $([].slice.call(document.querySelectorAll(queries.join(',')))) if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) { - $link.closest(SELECTOR_DROPDOWN).find(SELECTOR_DROPDOWN_TOGGLE).addClass(CLASS_NAME_ACTIVE) + $link.closest(SELECTOR_DROPDOWN) + .find(SELECTOR_DROPDOWN_TOGGLE) + .addClass(CLASS_NAME_ACTIVE) $link.addClass(CLASS_NAME_ACTIVE) } else { // Set triggered link as active $link.addClass(CLASS_NAME_ACTIVE) // Set triggered links parents as active // With both