0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-28 10:24:19 +01:00

Join/break a few lines, no functional changes

This commit is contained in:
XhmikosR 2020-05-08 10:21:04 +03:00
parent b3601aae5b
commit 52fdab8d70
6 changed files with 23 additions and 36 deletions

View File

@ -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))

View File

@ -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),

View File

@ -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 <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
$link.parents(SELECTOR_NAV_LIST_GROUP).prev(`${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`).addClass(CLASS_NAME_ACTIVE)
$link.parents(SELECTOR_NAV_LIST_GROUP)
.prev(`${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`)
.addClass(CLASS_NAME_ACTIVE)
// Handle special case when .nav-link is inside .nav-item
$link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE)
$link.parents(SELECTOR_NAV_LIST_GROUP)
.prev(SELECTOR_NAV_ITEMS)
.children(SELECTOR_NAV_LINKS)
.addClass(CLASS_NAME_ACTIVE)
}
$(this._scrollElement).trigger(EVENT_ACTIVATE, {

View File

@ -163,11 +163,7 @@ class Toast {
}
_setListeners() {
$(this._element).on(
EVENT_CLICK_DISMISS,
SELECTOR_DATA_DISMISS,
() => this.hide()
)
$(this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide())
}
_close() {

View File

@ -519,16 +519,8 @@ class Tooltip {
: this.constructor.Event.FOCUSOUT
$(this.element)
.on(
eventIn,
this.config.selector,
(event) => this._enter(event)
)
.on(
eventOut,
this.config.selector,
(event) => this._leave(event)
)
.on(eventIn, this.config.selector, (event) => this._enter(event))
.on(eventOut, this.config.selector, (event) => this._leave(event))
}
})
@ -538,10 +530,7 @@ class Tooltip {
}
}
$(this.element).closest('.modal').on(
'hide.bs.modal',
this._hideModalHandler
)
$(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler)
if (this.config.selector) {
this.config = {

View File

@ -67,7 +67,6 @@ function setTransitionEndSupport() {
*/
const Util = {
TRANSITION_END: 'bsTransitionEnd',
getUID(prefix) {