0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +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() { _addEventListeners() {
if (this._config.keyboard) { if (this._config.keyboard) {
$(this._element) $(this._element).on(EVENT_KEYDOWN, (event) => this._keydown(event))
.on(EVENT_KEYDOWN, (event) => this._keydown(event))
} }
if (this._config.pause === 'hover') { 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) { if (this._pointerEvent) {
$(this._element).on(EVENT_POINTERDOWN, (event) => start(event)) $(this._element).on(EVENT_POINTERDOWN, (event) => start(event))
$(this._element).on(EVENT_POINTERUP, (event) => end(event)) $(this._element).on(EVENT_POINTERUP, (event) => end(event))
@ -386,8 +387,7 @@ class Carousel {
_setActiveIndicatorElement(element) { _setActiveIndicatorElement(element) {
if (this._indicatorsElement) { if (this._indicatorsElement) {
const indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE)) const indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE))
$(indicators) $(indicators).removeClass(CLASS_NAME_ACTIVE)
.removeClass(CLASS_NAME_ACTIVE)
const nextIndicator = this._indicatorsElement.children[ const nextIndicator = this._indicatorsElement.children[
this._getItemIndex(element) this._getItemIndex(element)
@ -572,8 +572,7 @@ class Carousel {
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
$(document) $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler)
.on(EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler)
$(window).on(EVENT_LOAD_DATA_API, () => { $(window).on(EVENT_LOAD_DATA_API, () => {
const carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE)) const carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE))

View File

@ -294,10 +294,9 @@ class Collapse {
parent = document.querySelector(this._config.parent) parent = document.querySelector(this._config.parent)
} }
const selector = const selector = `[data-toggle="collapse"][data-parent="${this._config.parent}"]`
`[data-toggle="collapse"][data-parent="${this._config.parent}"]`
const children = [].slice.call(parent.querySelectorAll(selector)) const children = [].slice.call(parent.querySelectorAll(selector))
$(children).each((i, element) => { $(children).each((i, element) => {
this._addAriaAndCollapsedClass( this._addAriaAndCollapsedClass(
Collapse._getTargetFromElement(element), Collapse._getTargetFromElement(element),

View File

@ -191,9 +191,7 @@ class ScrollSpy {
_process() { _process() {
const scrollTop = this._getScrollTop() + this._config.offset const scrollTop = this._getScrollTop() + this._config.offset
const scrollHeight = this._getScrollHeight() const scrollHeight = this._getScrollHeight()
const maxScroll = this._config.offset + const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight()
scrollHeight -
this._getOffsetHeight()
if (this._scrollHeight !== scrollHeight) { if (this._scrollHeight !== scrollHeight) {
this.refresh() this.refresh()
@ -238,16 +236,23 @@ class ScrollSpy {
const $link = $([].slice.call(document.querySelectorAll(queries.join(',')))) const $link = $([].slice.call(document.querySelectorAll(queries.join(','))))
if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) { 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) $link.addClass(CLASS_NAME_ACTIVE)
} else { } else {
// Set triggered link as active // Set triggered link as active
$link.addClass(CLASS_NAME_ACTIVE) $link.addClass(CLASS_NAME_ACTIVE)
// Set triggered links parents as active // Set triggered links parents as active
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor // 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 // 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, { $(this._scrollElement).trigger(EVENT_ACTIVATE, {

View File

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

View File

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

View File

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