0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

Unbreak lines.

This commit is contained in:
XhmikosR 2020-06-20 19:00:53 +03:00
parent 91c11d6465
commit f15af45c6e
7 changed files with 48 additions and 63 deletions

View File

@ -144,8 +144,7 @@ class Alert {
* Data Api implementation * Data Api implementation
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
EventHandler EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()))
.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()))
const $ = getjQuery() const $ = getjQuery()

View File

@ -263,15 +263,12 @@ class Carousel {
_addEventListeners() { _addEventListeners() {
if (this._config.keyboard) { if (this._config.keyboard) {
EventHandler EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event))
.on(this._element, EVENT_KEYDOWN, event => this._keydown(event))
} }
if (this._config.pause === 'hover') { if (this._config.pause === 'hover') {
EventHandler EventHandler.on(this._element, EVENT_MOUSEENTER, event => this.pause(event))
.on(this._element, EVENT_MOUSEENTER, event => this.pause(event)) EventHandler.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event))
EventHandler
.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event))
} }
if (this._config.touch && this._touchSupported) { if (this._config.touch && this._touchSupported) {
@ -476,24 +473,23 @@ class Carousel {
const transitionDuration = getTransitionDurationFromElement(activeElement) const transitionDuration = getTransitionDurationFromElement(activeElement)
EventHandler EventHandler.one(activeElement, TRANSITION_END, () => {
.one(activeElement, TRANSITION_END, () => { nextElement.classList.remove(directionalClassName, orderClassName)
nextElement.classList.remove(directionalClassName, orderClassName) nextElement.classList.add(CLASS_NAME_ACTIVE)
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(() => { setTimeout(() => {
EventHandler.trigger(this._element, EVENT_SLID, { EventHandler.trigger(this._element, EVENT_SLID, {
relatedTarget: nextElement, relatedTarget: nextElement,
direction: eventDirectionName, direction: eventDirectionName,
from: activeElementIndex, from: activeElementIndex,
to: nextElementIndex to: nextElementIndex
}) })
}, 0) }, 0)
}) })
emulateTransitionEnd(activeElement, transitionDuration) emulateTransitionEnd(activeElement, transitionDuration)
} else { } else {
@ -593,8 +589,7 @@ class Carousel {
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
EventHandler EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler)
.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler)
EventHandler.on(window, EVENT_LOAD_DATA_API, () => { EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE) const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE)

View File

@ -95,6 +95,7 @@ function getEvent(element) {
function bootstrapHandler(element, fn) { function bootstrapHandler(element, fn) {
return function handler(event) { return function handler(event) {
event.delegateTarget = element event.delegateTarget = element
if (handler.oneOff) { if (handler.oneOff) {
EventHandler.off(element, event.type, fn) EventHandler.off(element, event.type, fn)
} }
@ -111,6 +112,7 @@ function bootstrapDelegationHandler(element, selector, fn) {
for (let i = domElements.length; i--;) { for (let i = domElements.length; i--;) {
if (domElements[i] === target) { if (domElements[i] === target) {
event.delegateTarget = target event.delegateTarget = target
if (handler.oneOff) { if (handler.oneOff) {
EventHandler.off(element, event.type, fn) EventHandler.off(element, event.type, fn)
} }

View File

@ -468,8 +468,7 @@ class Dropdown {
return return
} }
const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent) const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible)
.filter(isVisible)
if (!items.length) { if (!items.length) {
return return
@ -511,8 +510,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
event.stopPropagation() event.stopPropagation()
Dropdown.dropdownInterface(this, 'toggle') Dropdown.dropdownInterface(this, 'toggle')
}) })
EventHandler EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, e => e.stopPropagation())
.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, e => e.stopPropagation())
const $ = getjQuery() const $ = getjQuery()

View File

@ -118,27 +118,26 @@ class ScrollSpy {
const targets = SelectorEngine.find(this._selector) const targets = SelectorEngine.find(this._selector)
targets targets.map(element => {
.map(element => { let target
let target const targetSelector = getSelectorFromElement(element)
const targetSelector = getSelectorFromElement(element)
if (targetSelector) { if (targetSelector) {
target = SelectorEngine.findOne(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) { return null
const targetBCR = target.getBoundingClientRect() })
if (targetBCR.width || targetBCR.height) {
return [
Manipulator[offsetMethod](target).top + offsetBase,
targetSelector
]
}
}
return null
})
.filter(item => item) .filter(item => item)
.sort((a, b) => a[0] - b[0]) .sort((a, b) => a[0] - b[0])
.forEach(item => { .forEach(item => {
@ -253,8 +252,7 @@ class ScrollSpy {
const link = SelectorEngine.findOne(queries.join(',')) const link = SelectorEngine.findOne(queries.join(','))
if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
SelectorEngine SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN))
.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN))
.classList.add(CLASS_NAME_ACTIVE) .classList.add(CLASS_NAME_ACTIVE)
link.classList.add(CLASS_NAME_ACTIVE) link.classList.add(CLASS_NAME_ACTIVE)
@ -262,8 +260,7 @@ class ScrollSpy {
// Set triggered link as active // Set triggered link as active
link.classList.add(CLASS_NAME_ACTIVE) link.classList.add(CLASS_NAME_ACTIVE)
SelectorEngine SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP)
.parents(link, SELECTOR_NAV_LIST_GROUP)
.forEach(listGroup => { .forEach(listGroup => {
// 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

View File

@ -179,12 +179,7 @@ class Toast {
} }
_setListeners() { _setListeners() {
EventHandler.on( EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide())
this._element,
EVENT_CLICK_DISMISS,
SELECTOR_DATA_DISMISS,
() => this.hide()
)
} }
_clearTimeout() { _clearTimeout() {

View File

@ -676,12 +676,11 @@ class Tooltip {
_getConfig(config) { _getConfig(config) {
const dataAttributes = Manipulator.getDataAttributes(this.element) const dataAttributes = Manipulator.getDataAttributes(this.element)
Object.keys(dataAttributes) Object.keys(dataAttributes).forEach(dataAttr => {
.forEach(dataAttr => { if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { delete dataAttributes[dataAttr]
delete dataAttributes[dataAttr] }
} })
})
if (config && typeof config.container === 'object' && config.container.jquery) { if (config && typeof config.container === 'object' && config.container.jquery) {
config.container = config.container[0] config.container = config.container[0]