1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-16 02:24:19 +02:00

upgrade to v4 stable

This commit is contained in:
Johann-S
2018-03-05 15:40:23 +01:00
committed by XhmikosR
parent 7f08061eca
commit 9744886519
4 changed files with 33 additions and 17 deletions

View File

@@ -22,7 +22,6 @@ const VERSION = '4.3.1'
const DATA_KEY = 'bs.carousel'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME]
const ARROW_LEFT_KEYCODE = 37 // KeyboardEvent.which value for left arrow key
const ARROW_RIGHT_KEYCODE = 39 // KeyboardEvent.which value for right arrow key
const TOUCHEVENT_COMPAT_WAIT = 500 // Time for mouse compat events to fire after touch
@@ -527,6 +526,7 @@ class Carousel {
if (!data) {
data = new Carousel(element, _config)
Data.setData(element, DATA_KEY, data)
}
if (typeof config === 'number') {
@@ -602,13 +602,18 @@ EventHandler.on(window, Event.LOAD_DATA_API, () => {
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
* add .carousel to jQuery only if jQuery is present
*/
$.fn[NAME] = Carousel._jQueryInterface
$.fn[NAME].Constructor = Carousel
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Carousel._jQueryInterface
if (typeof window.$ !== 'undefined' || typeof window.jQuery !== 'undefined') {
const $ = window.$ || window.jQuery
const JQUERY_NO_CONFLICT = $.fn[NAME]
$.fn[NAME] = Carousel._jQueryInterface
$.fn[NAME].Constructor = Carousel
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Carousel._jQueryInterface
}
}
export default Carousel

View File

@@ -142,7 +142,11 @@ class Collapse {
}
if (actives) {
activesData = Data.getData(actives[0], DATA_KEY)
const tempActiveData = actives.filter((elem) => {
const container = SelectorEngine.findOne(this._selector)
return !container.contains(elem)
})
activesData = tempActiveData[0] ? Data.getData(tempActiveData[0], DATA_KEY) : null
if (activesData && activesData._isTransitioning) {
return
}
@@ -154,7 +158,12 @@ class Collapse {
}
if (actives) {
actives.forEach((elemActive) => Collapse._collapseInterface(elemActive, 'hide'))
actives.forEach((elemActive) => {
const container = SelectorEngine.findOne(this._selector)
if (!container.contains(elemActive)) {
Collapse._collapseInterface(elemActive, 'hide')
}
})
if (!activesData) {
Data.setData(actives[0], DATA_KEY, null)
}