mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-20 20:00:36 +03:00
Comply to the new rules
This commit is contained in:
@@ -39,7 +39,7 @@ const bsPlugins = {
|
|||||||
}
|
}
|
||||||
const rootPath = TEST ? '../js/coverage/dist/' : '../js/dist/'
|
const rootPath = TEST ? '../js/coverage/dist/' : '../js/dist/'
|
||||||
|
|
||||||
const build = async (plugin) => {
|
const build = async plugin => {
|
||||||
console.log(`Building ${plugin} plugin...`)
|
console.log(`Building ${plugin} plugin...`)
|
||||||
|
|
||||||
const external = ['jquery', 'popper.js']
|
const external = ['jquery', 'popper.js']
|
||||||
@@ -81,7 +81,7 @@ const build = async (plugin) => {
|
|||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
try {
|
try {
|
||||||
await Promise.all(Object.keys(bsPlugins).map((plugin) => build(plugin)))
|
await Promise.all(Object.keys(bsPlugins).map(plugin => build(plugin)))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|
||||||
|
|||||||
@@ -30,18 +30,21 @@ function walkAsync(directory, excludedDirectories, fileCallback, errback) {
|
|||||||
if (excludedDirectories.has(path.parse(directory).base)) {
|
if (excludedDirectories.has(path.parse(directory).base)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.readdir(directory, (err, names) => {
|
fs.readdir(directory, (err, names) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
errback(err)
|
errback(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
names.forEach((name) => {
|
|
||||||
|
names.forEach(name => {
|
||||||
const filepath = path.join(directory, name)
|
const filepath = path.join(directory, name)
|
||||||
fs.lstat(filepath, (err, stats) => {
|
fs.lstat(filepath, (err, stats) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
process.nextTick(errback, err)
|
process.nextTick(errback, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats.isDirectory()) {
|
if (stats.isDirectory()) {
|
||||||
process.nextTick(walkAsync, filepath, excludedDirectories, fileCallback, errback)
|
process.nextTick(walkAsync, filepath, excludedDirectories, fileCallback, errback)
|
||||||
} else if (stats.isFile()) {
|
} else if (stats.isFile()) {
|
||||||
@@ -55,18 +58,19 @@ function walkAsync(directory, excludedDirectories, fileCallback, errback) {
|
|||||||
function replaceRecursively(directory, excludedDirectories, allowedExtensions, original, replacement) {
|
function replaceRecursively(directory, excludedDirectories, allowedExtensions, original, replacement) {
|
||||||
original = new RegExp(regExpQuote(original), 'g')
|
original = new RegExp(regExpQuote(original), 'g')
|
||||||
replacement = regExpQuoteReplacement(replacement)
|
replacement = regExpQuoteReplacement(replacement)
|
||||||
const updateFile = DRY_RUN ? (filepath) => {
|
const updateFile = DRY_RUN ? filepath => {
|
||||||
if (allowedExtensions.has(path.parse(filepath).ext)) {
|
if (allowedExtensions.has(path.parse(filepath).ext)) {
|
||||||
console.log(`FILE: ${filepath}`)
|
console.log(`FILE: ${filepath}`)
|
||||||
} else {
|
} else {
|
||||||
console.log(`EXCLUDED:${filepath}`)
|
console.log(`EXCLUDED:${filepath}`)
|
||||||
}
|
}
|
||||||
} : (filepath) => {
|
} : filepath => {
|
||||||
if (allowedExtensions.has(path.parse(filepath).ext)) {
|
if (allowedExtensions.has(path.parse(filepath).ext)) {
|
||||||
sh.sed('-i', original, replacement, filepath)
|
sh.sed('-i', original, replacement, filepath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
walkAsync(directory, excludedDirectories, updateFile, (err) => {
|
|
||||||
|
walkAsync(directory, excludedDirectories, updateFile, err => {
|
||||||
console.error('ERROR while traversing directory!:')
|
console.error('ERROR while traversing directory!:')
|
||||||
console.error(err)
|
console.error(err)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
@@ -79,6 +83,7 @@ function main(args) {
|
|||||||
console.error('Got arguments:', args)
|
console.error('Got arguments:', args)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const oldVersion = args[0]
|
const oldVersion = args[0]
|
||||||
const newVersion = args[1]
|
const newVersion = args[1]
|
||||||
const EXCLUDED_DIRS = new Set([
|
const EXCLUDED_DIRS = new Set([
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ const files = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
files.forEach((file) => {
|
files.forEach(file => {
|
||||||
fs.readFile(file.file, 'utf8', (err, data) => {
|
fs.readFile(file.file, 'utf8', (err, data) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err
|
throw err
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
module.exports = (ctx) => ({
|
module.exports = ctx => ({
|
||||||
map: ctx.file.dirname.includes('examples') ? false : {
|
map: ctx.file.dirname.includes('examples') ? false : {
|
||||||
inline: false,
|
inline: false,
|
||||||
annotation: true,
|
annotation: true,
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ sh.cp('-f', [
|
|||||||
sh.rm(`${folderName}/index.html`)
|
sh.rm(`${folderName}/index.html`)
|
||||||
|
|
||||||
// get all examples' HTML files
|
// get all examples' HTML files
|
||||||
sh.find(`${folderName}/**/*.html`).forEach((file) => {
|
sh.find(`${folderName}/**/*.html`).forEach(file => {
|
||||||
const fileContents = sh.cat(file)
|
const fileContents = sh.cat(file)
|
||||||
.toString()
|
.toString()
|
||||||
.replace(new RegExp(`"/docs/${versionShort}/`, 'g'), '"../')
|
.replace(new RegExp(`"/docs/${versionShort}/`, 'g'), '"../')
|
||||||
|
|||||||
+1
-1
@@ -105,7 +105,7 @@ class Alert {
|
|||||||
const transitionDuration = Util.getTransitionDurationFromElement(element)
|
const transitionDuration = Util.getTransitionDurationFromElement(element)
|
||||||
|
|
||||||
$(element)
|
$(element)
|
||||||
.one(Util.TRANSITION_END, (event) => this._destroyElement(element, event))
|
.one(Util.TRANSITION_END, event => this._destroyElement(element, event))
|
||||||
.emulateTransitionEnd(transitionDuration)
|
.emulateTransitionEnd(transitionDuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -85,6 +85,7 @@ class Button {
|
|||||||
if (input.type === 'checkbox' || input.type === 'radio') {
|
if (input.type === 'checkbox' || input.type === 'radio') {
|
||||||
input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE)
|
input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE)
|
||||||
}
|
}
|
||||||
|
|
||||||
$(input).trigger('change')
|
$(input).trigger('change')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +136,7 @@ class Button {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$(document)
|
$(document)
|
||||||
.on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, (event) => {
|
.on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, event => {
|
||||||
let button = event.target
|
let button = event.target
|
||||||
const initialButton = button
|
const initialButton = button
|
||||||
|
|
||||||
@@ -158,7 +159,7 @@ $(document)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, (event) => {
|
.on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, event => {
|
||||||
const button = $(event.target).closest(SELECTOR_BUTTON)[0]
|
const button = $(event.target).closest(SELECTOR_BUTTON)[0]
|
||||||
$(button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type))
|
$(button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type))
|
||||||
})
|
})
|
||||||
|
|||||||
+23
-21
@@ -195,9 +195,9 @@ class Carousel {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const direction = index > activeIndex
|
const direction = index > activeIndex ?
|
||||||
? DIRECTION_NEXT
|
DIRECTION_NEXT :
|
||||||
: DIRECTION_PREV
|
DIRECTION_PREV
|
||||||
|
|
||||||
this._slide(direction, this._items[index])
|
this._slide(direction, this._items[index])
|
||||||
}
|
}
|
||||||
@@ -251,13 +251,13 @@ class Carousel {
|
|||||||
|
|
||||||
_addEventListeners() {
|
_addEventListeners() {
|
||||||
if (this._config.keyboard) {
|
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') {
|
if (this._config.pause === 'hover') {
|
||||||
$(this._element)
|
$(this._element)
|
||||||
.on(EVENT_MOUSEENTER, (event) => this.pause(event))
|
.on(EVENT_MOUSEENTER, event => this.pause(event))
|
||||||
.on(EVENT_MOUSELEAVE, (event) => this.cycle(event))
|
.on(EVENT_MOUSELEAVE, event => this.cycle(event))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._config.touch) {
|
if (this._config.touch) {
|
||||||
@@ -270,7 +270,7 @@ class Carousel {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const start = (event) => {
|
const start = event => {
|
||||||
if (this._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
|
if (this._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
|
||||||
this.touchStartX = event.originalEvent.clientX
|
this.touchStartX = event.originalEvent.clientX
|
||||||
} else if (!this._pointerEvent) {
|
} else if (!this._pointerEvent) {
|
||||||
@@ -278,7 +278,7 @@ class Carousel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const move = (event) => {
|
const move = event => {
|
||||||
// ensure swiping with one touch and not pinching
|
// ensure swiping with one touch and not pinching
|
||||||
if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
|
if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
|
||||||
this.touchDeltaX = 0
|
this.touchDeltaX = 0
|
||||||
@@ -287,7 +287,7 @@ class Carousel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const end = (event) => {
|
const end = event => {
|
||||||
if (this._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
|
if (this._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
|
||||||
this.touchDeltaX = event.originalEvent.clientX - this.touchStartX
|
this.touchDeltaX = event.originalEvent.clientX - this.touchStartX
|
||||||
}
|
}
|
||||||
@@ -306,22 +306,23 @@ class Carousel {
|
|||||||
if (this.touchTimeout) {
|
if (this.touchTimeout) {
|
||||||
clearTimeout(this.touchTimeout)
|
clearTimeout(this.touchTimeout)
|
||||||
}
|
}
|
||||||
this.touchTimeout = setTimeout((event) => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval)
|
|
||||||
|
this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this._element.querySelectorAll(SELECTOR_ITEM_IMG))
|
$(this._element.querySelectorAll(SELECTOR_ITEM_IMG))
|
||||||
.on(EVENT_DRAG_START, (e) => e.preventDefault())
|
.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))
|
||||||
|
|
||||||
this._element.classList.add(CLASS_NAME_POINTER_EVENT)
|
this._element.classList.add(CLASS_NAME_POINTER_EVENT)
|
||||||
} else {
|
} else {
|
||||||
$(this._element).on(EVENT_TOUCHSTART, (event) => start(event))
|
$(this._element).on(EVENT_TOUCHSTART, event => start(event))
|
||||||
$(this._element).on(EVENT_TOUCHMOVE, (event) => move(event))
|
$(this._element).on(EVENT_TOUCHMOVE, event => move(event))
|
||||||
$(this._element).on(EVENT_TOUCHEND, (event) => end(event))
|
$(this._element).on(EVENT_TOUCHEND, event => end(event))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,9 +345,9 @@ class Carousel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_getItemIndex(element) {
|
_getItemIndex(element) {
|
||||||
this._items = element && element.parentNode
|
this._items = element && element.parentNode ?
|
||||||
? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM))
|
[].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) :
|
||||||
: []
|
[]
|
||||||
return this._items.indexOf(element)
|
return this._items.indexOf(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,8 +366,8 @@ class Carousel {
|
|||||||
const delta = direction === DIRECTION_PREV ? -1 : 1
|
const delta = direction === DIRECTION_PREV ? -1 : 1
|
||||||
const itemIndex = (activeIndex + delta) % this._items.length
|
const itemIndex = (activeIndex + delta) % this._items.length
|
||||||
|
|
||||||
return itemIndex === -1
|
return itemIndex === -1 ?
|
||||||
? this._items[this._items.length - 1] : this._items[itemIndex]
|
this._items[this._items.length - 1] : this._items[itemIndex]
|
||||||
}
|
}
|
||||||
|
|
||||||
_triggerSlideEvent(relatedTarget, eventDirectionName) {
|
_triggerSlideEvent(relatedTarget, eventDirectionName) {
|
||||||
@@ -525,6 +526,7 @@ class Carousel {
|
|||||||
if (typeof data[action] === 'undefined') {
|
if (typeof data[action] === 'undefined') {
|
||||||
throw new TypeError(`No method named "${action}"`)
|
throw new TypeError(`No method named "${action}"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
data[action]()
|
data[action]()
|
||||||
} else if (_config.interval && _config.ride) {
|
} else if (_config.interval && _config.ride) {
|
||||||
data.pause()
|
data.pause()
|
||||||
|
|||||||
+3
-2
@@ -69,7 +69,7 @@ class Collapse {
|
|||||||
const elem = toggleList[i]
|
const elem = toggleList[i]
|
||||||
const selector = Util.getSelectorFromElement(elem)
|
const selector = Util.getSelectorFromElement(elem)
|
||||||
const filterElement = [].slice.call(document.querySelectorAll(selector))
|
const filterElement = [].slice.call(document.querySelectorAll(selector))
|
||||||
.filter((foundElem) => foundElem === element)
|
.filter(foundElem => foundElem === element)
|
||||||
|
|
||||||
if (selector !== null && filterElement.length > 0) {
|
if (selector !== null && filterElement.length > 0) {
|
||||||
this._selector = selector
|
this._selector = selector
|
||||||
@@ -119,7 +119,7 @@ class Collapse {
|
|||||||
|
|
||||||
if (this._parent) {
|
if (this._parent) {
|
||||||
actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES))
|
actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES))
|
||||||
.filter((elem) => {
|
.filter(elem => {
|
||||||
if (typeof this._config.parent === 'string') {
|
if (typeof this._config.parent === 'string') {
|
||||||
return elem.getAttribute('data-parent') === this._config.parent
|
return elem.getAttribute('data-parent') === this._config.parent
|
||||||
}
|
}
|
||||||
@@ -345,6 +345,7 @@ class Collapse {
|
|||||||
if (typeof data[config] === 'undefined') {
|
if (typeof data[config] === 'undefined') {
|
||||||
throw new TypeError(`No method named "${config}"`)
|
throw new TypeError(`No method named "${config}"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
data[config]()
|
data[config]()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
+13
-9
@@ -172,6 +172,7 @@ class Dropdown {
|
|||||||
if (this._config.boundary !== 'scrollParent') {
|
if (this._config.boundary !== 'scrollParent') {
|
||||||
$(parent).addClass(CLASS_NAME_POSITION_STATIC)
|
$(parent).addClass(CLASS_NAME_POSITION_STATIC)
|
||||||
}
|
}
|
||||||
|
|
||||||
this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig())
|
this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +242,7 @@ class Dropdown {
|
|||||||
// Private
|
// Private
|
||||||
|
|
||||||
_addEventListeners() {
|
_addEventListeners() {
|
||||||
$(this._element).on(EVENT_CLICK, (event) => {
|
$(this._element).on(EVENT_CLICK, event => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
this.toggle()
|
this.toggle()
|
||||||
@@ -272,6 +273,7 @@ class Dropdown {
|
|||||||
this._menu = parent.querySelector(SELECTOR_MENU)
|
this._menu = parent.querySelector(SELECTOR_MENU)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._menu
|
return this._menu
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,9 +283,9 @@ class Dropdown {
|
|||||||
|
|
||||||
// Handle dropup
|
// Handle dropup
|
||||||
if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) {
|
if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) {
|
||||||
placement = $(this._menu).hasClass(CLASS_NAME_MENURIGHT)
|
placement = $(this._menu).hasClass(CLASS_NAME_MENURIGHT) ?
|
||||||
? PLACEMENT_TOPEND
|
PLACEMENT_TOPEND :
|
||||||
: PLACEMENT_TOP
|
PLACEMENT_TOP
|
||||||
} else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) {
|
} else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) {
|
||||||
placement = PLACEMENT_RIGHT
|
placement = PLACEMENT_RIGHT
|
||||||
} else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) {
|
} else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) {
|
||||||
@@ -291,6 +293,7 @@ class Dropdown {
|
|||||||
} else if ($(this._menu).hasClass(CLASS_NAME_MENURIGHT)) {
|
} else if ($(this._menu).hasClass(CLASS_NAME_MENURIGHT)) {
|
||||||
placement = PLACEMENT_BOTTOMEND
|
placement = PLACEMENT_BOTTOMEND
|
||||||
}
|
}
|
||||||
|
|
||||||
return placement
|
return placement
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +305,7 @@ class Dropdown {
|
|||||||
const offset = {}
|
const offset = {}
|
||||||
|
|
||||||
if (typeof this._config.offset === 'function') {
|
if (typeof this._config.offset === 'function') {
|
||||||
offset.fn = (data) => {
|
offset.fn = data => {
|
||||||
data.offsets = {
|
data.offsets = {
|
||||||
...data.offsets,
|
...data.offsets,
|
||||||
...this._config.offset(data.offsets, this._element) || {}
|
...this._config.offset(data.offsets, this._element) || {}
|
||||||
@@ -360,6 +363,7 @@ class Dropdown {
|
|||||||
if (typeof data[config] === 'undefined') {
|
if (typeof data[config] === 'undefined') {
|
||||||
throw new TypeError(`No method named "${config}"`)
|
throw new TypeError(`No method named "${config}"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
data[config]()
|
data[config]()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -444,8 +448,8 @@ class Dropdown {
|
|||||||
// - If key is other than escape
|
// - If key is other than escape
|
||||||
// - If key is not up or down => not a dropdown command
|
// - If key is not up or down => not a dropdown command
|
||||||
// - If trigger inside the menu => not a dropdown command
|
// - If trigger inside the menu => not a dropdown command
|
||||||
if (/input|textarea/i.test(event.target.tagName)
|
if (/input|textarea/i.test(event.target.tagName) ?
|
||||||
? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE &&
|
event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE &&
|
||||||
(event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE ||
|
(event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE ||
|
||||||
$(event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
|
$(event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
|
||||||
return
|
return
|
||||||
@@ -475,7 +479,7 @@ class Dropdown {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS))
|
const items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS))
|
||||||
.filter((item) => $(item).is(':visible'))
|
.filter(item => $(item).is(':visible'))
|
||||||
|
|
||||||
if (items.length === 0) {
|
if (items.length === 0) {
|
||||||
return
|
return
|
||||||
@@ -514,7 +518,7 @@ $(document)
|
|||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
Dropdown._jQueryInterface.call($(this), 'toggle')
|
Dropdown._jQueryInterface.call($(this), 'toggle')
|
||||||
})
|
})
|
||||||
.on(EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, (e) => {
|
.on(EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, e => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
+16
-13
@@ -131,11 +131,11 @@ class Modal {
|
|||||||
$(this._element).on(
|
$(this._element).on(
|
||||||
EVENT_CLICK_DISMISS,
|
EVENT_CLICK_DISMISS,
|
||||||
SELECTOR_DATA_DISMISS,
|
SELECTOR_DATA_DISMISS,
|
||||||
(event) => this.hide(event)
|
event => this.hide(event)
|
||||||
)
|
)
|
||||||
|
|
||||||
$(this._dialog).on(EVENT_MOUSEDOWN_DISMISS, () => {
|
$(this._dialog).on(EVENT_MOUSEDOWN_DISMISS, () => {
|
||||||
$(this._element).one(EVENT_MOUSEUP_DISMISS, (event) => {
|
$(this._element).one(EVENT_MOUSEUP_DISMISS, event => {
|
||||||
if ($(event.target).is(this._element)) {
|
if ($(event.target).is(this._element)) {
|
||||||
this._ignoreBackdropClick = true
|
this._ignoreBackdropClick = true
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ class Modal {
|
|||||||
const transitionDuration = Util.getTransitionDurationFromElement(this._element)
|
const transitionDuration = Util.getTransitionDurationFromElement(this._element)
|
||||||
|
|
||||||
$(this._element)
|
$(this._element)
|
||||||
.one(Util.TRANSITION_END, (event) => this._hideModal(event))
|
.one(Util.TRANSITION_END, event => this._hideModal(event))
|
||||||
.emulateTransitionEnd(transitionDuration)
|
.emulateTransitionEnd(transitionDuration)
|
||||||
} else {
|
} else {
|
||||||
this._hideModal()
|
this._hideModal()
|
||||||
@@ -192,7 +192,7 @@ class Modal {
|
|||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
[window, this._element, this._dialog]
|
[window, this._element, this._dialog]
|
||||||
.forEach((htmlElement) => $(htmlElement).off(EVENT_KEY))
|
.forEach(htmlElement => $(htmlElement).off(EVENT_KEY))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
|
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
|
||||||
@@ -304,6 +304,7 @@ class Modal {
|
|||||||
if (this._config.focus) {
|
if (this._config.focus) {
|
||||||
this._element.focus()
|
this._element.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
this._isTransitioning = false
|
this._isTransitioning = false
|
||||||
$(this._element).trigger(shownEvent)
|
$(this._element).trigger(shownEvent)
|
||||||
}
|
}
|
||||||
@@ -322,7 +323,7 @@ class Modal {
|
|||||||
_enforceFocus() {
|
_enforceFocus() {
|
||||||
$(document)
|
$(document)
|
||||||
.off(EVENT_FOCUSIN) // Guard against infinite focus loop
|
.off(EVENT_FOCUSIN) // Guard against infinite focus loop
|
||||||
.on(EVENT_FOCUSIN, (event) => {
|
.on(EVENT_FOCUSIN, event => {
|
||||||
if (document !== event.target &&
|
if (document !== event.target &&
|
||||||
this._element !== event.target &&
|
this._element !== event.target &&
|
||||||
$(this._element).has(event.target).length === 0) {
|
$(this._element).has(event.target).length === 0) {
|
||||||
@@ -333,7 +334,7 @@ class Modal {
|
|||||||
|
|
||||||
_setEscapeEvent() {
|
_setEscapeEvent() {
|
||||||
if (this._isShown) {
|
if (this._isShown) {
|
||||||
$(this._element).on(EVENT_KEYDOWN_DISMISS, (event) => {
|
$(this._element).on(EVENT_KEYDOWN_DISMISS, event => {
|
||||||
if (this._config.keyboard && event.which === ESCAPE_KEYCODE) {
|
if (this._config.keyboard && event.which === ESCAPE_KEYCODE) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
this.hide()
|
this.hide()
|
||||||
@@ -348,7 +349,7 @@ class Modal {
|
|||||||
|
|
||||||
_setResizeEvent() {
|
_setResizeEvent() {
|
||||||
if (this._isShown) {
|
if (this._isShown) {
|
||||||
$(window).on(EVENT_RESIZE, (event) => this.handleUpdate(event))
|
$(window).on(EVENT_RESIZE, event => this.handleUpdate(event))
|
||||||
} else {
|
} else {
|
||||||
$(window).off(EVENT_RESIZE)
|
$(window).off(EVENT_RESIZE)
|
||||||
}
|
}
|
||||||
@@ -376,8 +377,8 @@ class Modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_showBackdrop(callback) {
|
_showBackdrop(callback) {
|
||||||
const animate = $(this._element).hasClass(CLASS_NAME_FADE)
|
const animate = $(this._element).hasClass(CLASS_NAME_FADE) ?
|
||||||
? CLASS_NAME_FADE : ''
|
CLASS_NAME_FADE : ''
|
||||||
|
|
||||||
if (this._isShown && this._config.backdrop) {
|
if (this._isShown && this._config.backdrop) {
|
||||||
this._backdrop = document.createElement('div')
|
this._backdrop = document.createElement('div')
|
||||||
@@ -389,11 +390,12 @@ class Modal {
|
|||||||
|
|
||||||
$(this._backdrop).appendTo(document.body)
|
$(this._backdrop).appendTo(document.body)
|
||||||
|
|
||||||
$(this._element).on(EVENT_CLICK_DISMISS, (event) => {
|
$(this._element).on(EVENT_CLICK_DISMISS, event => {
|
||||||
if (this._ignoreBackdropClick) {
|
if (this._ignoreBackdropClick) {
|
||||||
this._ignoreBackdropClick = false
|
this._ignoreBackdropClick = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.target !== event.currentTarget) {
|
if (event.target !== event.currentTarget) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -563,6 +565,7 @@ class Modal {
|
|||||||
if (typeof data[config] === 'undefined') {
|
if (typeof data[config] === 'undefined') {
|
||||||
throw new TypeError(`No method named "${config}"`)
|
throw new TypeError(`No method named "${config}"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
data[config](relatedTarget)
|
data[config](relatedTarget)
|
||||||
} else if (_config.show) {
|
} else if (_config.show) {
|
||||||
data.show(relatedTarget)
|
data.show(relatedTarget)
|
||||||
@@ -585,8 +588,8 @@ $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
|||||||
target = document.querySelector(selector)
|
target = document.querySelector(selector)
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = $(target).data(DATA_KEY)
|
const config = $(target).data(DATA_KEY) ?
|
||||||
? 'toggle' : {
|
'toggle' : {
|
||||||
...$(target).data(),
|
...$(target).data(),
|
||||||
...$(this).data()
|
...$(this).data()
|
||||||
}
|
}
|
||||||
@@ -595,7 +598,7 @@ $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
|||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
const $target = $(target).one(EVENT_SHOW, (showEvent) => {
|
const $target = $(target).one(EVENT_SHOW, showEvent => {
|
||||||
if (showEvent.isDefaultPrevented()) {
|
if (showEvent.isDefaultPrevented()) {
|
||||||
// Only register focus restorer if modal will actually get shown
|
// Only register focus restorer if modal will actually get shown
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ class Popover extends Tooltip {
|
|||||||
if (typeof content === 'function') {
|
if (typeof content === 'function') {
|
||||||
content = content.call(this.element)
|
content = content.call(this.element)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setElementContent($tip.find(SELECTOR_CONTENT), content)
|
this.setElementContent($tip.find(SELECTOR_CONTENT), content)
|
||||||
|
|
||||||
$tip.removeClass(`${CLASS_NAME_FADE} ${CLASS_NAME_SHOW}`)
|
$tip.removeClass(`${CLASS_NAME_FADE} ${CLASS_NAME_SHOW}`)
|
||||||
@@ -158,6 +159,7 @@ class Popover extends Tooltip {
|
|||||||
if (typeof data[config] === 'undefined') {
|
if (typeof data[config] === 'undefined') {
|
||||||
throw new TypeError(`No method named "${config}"`)
|
throw new TypeError(`No method named "${config}"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
data[config]()
|
data[config]()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
+21
-17
@@ -71,7 +71,7 @@ class ScrollSpy {
|
|||||||
this._activeTarget = null
|
this._activeTarget = null
|
||||||
this._scrollHeight = 0
|
this._scrollHeight = 0
|
||||||
|
|
||||||
$(this._scrollElement).on(EVENT_SCROLL, (event) => this._process(event))
|
$(this._scrollElement).on(EVENT_SCROLL, event => this._process(event))
|
||||||
|
|
||||||
this.refresh()
|
this.refresh()
|
||||||
this._process()
|
this._process()
|
||||||
@@ -90,14 +90,14 @@ class ScrollSpy {
|
|||||||
// Public
|
// Public
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
const autoMethod = this._scrollElement === this._scrollElement.window
|
const autoMethod = this._scrollElement === this._scrollElement.window ?
|
||||||
? METHOD_OFFSET : METHOD_POSITION
|
METHOD_OFFSET : METHOD_POSITION
|
||||||
|
|
||||||
const offsetMethod = this._config.method === 'auto'
|
const offsetMethod = this._config.method === 'auto' ?
|
||||||
? autoMethod : this._config.method
|
autoMethod : this._config.method
|
||||||
|
|
||||||
const offsetBase = offsetMethod === METHOD_POSITION
|
const offsetBase = offsetMethod === METHOD_POSITION ?
|
||||||
? this._getScrollTop() : 0
|
this._getScrollTop() : 0
|
||||||
|
|
||||||
this._offsets = []
|
this._offsets = []
|
||||||
this._targets = []
|
this._targets = []
|
||||||
@@ -107,7 +107,7 @@ class ScrollSpy {
|
|||||||
const targets = [].slice.call(document.querySelectorAll(this._selector))
|
const targets = [].slice.call(document.querySelectorAll(this._selector))
|
||||||
|
|
||||||
targets
|
targets
|
||||||
.map((element) => {
|
.map(element => {
|
||||||
let target
|
let target
|
||||||
const targetSelector = Util.getSelectorFromElement(element)
|
const targetSelector = Util.getSelectorFromElement(element)
|
||||||
|
|
||||||
@@ -125,11 +125,12 @@ class ScrollSpy {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null
|
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 => {
|
||||||
this._offsets.push(item[0])
|
this._offsets.push(item[0])
|
||||||
this._targets.push(item[1])
|
this._targets.push(item[1])
|
||||||
})
|
})
|
||||||
@@ -163,6 +164,7 @@ class ScrollSpy {
|
|||||||
id = Util.getUID(NAME)
|
id = Util.getUID(NAME)
|
||||||
$(config.target).attr('id', id)
|
$(config.target).attr('id', id)
|
||||||
}
|
}
|
||||||
|
|
||||||
config.target = `#${id}`
|
config.target = `#${id}`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,8 +174,8 @@ class ScrollSpy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_getScrollTop() {
|
_getScrollTop() {
|
||||||
return this._scrollElement === window
|
return this._scrollElement === window ?
|
||||||
? this._scrollElement.pageYOffset : this._scrollElement.scrollTop
|
this._scrollElement.pageYOffset : this._scrollElement.scrollTop
|
||||||
}
|
}
|
||||||
|
|
||||||
_getScrollHeight() {
|
_getScrollHeight() {
|
||||||
@@ -184,8 +186,8 @@ class ScrollSpy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_getOffsetHeight() {
|
_getOffsetHeight() {
|
||||||
return this._scrollElement === window
|
return this._scrollElement === window ?
|
||||||
? window.innerHeight : this._scrollElement.getBoundingClientRect().height
|
window.innerHeight : this._scrollElement.getBoundingClientRect().height
|
||||||
}
|
}
|
||||||
|
|
||||||
_process() {
|
_process() {
|
||||||
@@ -203,6 +205,7 @@ class ScrollSpy {
|
|||||||
if (this._activeTarget !== target) {
|
if (this._activeTarget !== target) {
|
||||||
this._activate(target)
|
this._activate(target)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +234,7 @@ class ScrollSpy {
|
|||||||
|
|
||||||
const queries = this._selector
|
const queries = this._selector
|
||||||
.split(',')
|
.split(',')
|
||||||
.map((selector) => `${selector}[data-target="${target}"],${selector}[href="${target}"]`)
|
.map(selector => `${selector}[data-target="${target}"],${selector}[href="${target}"]`)
|
||||||
|
|
||||||
const $link = $([].slice.call(document.querySelectorAll(queries.join(','))))
|
const $link = $([].slice.call(document.querySelectorAll(queries.join(','))))
|
||||||
|
|
||||||
@@ -262,8 +265,8 @@ class ScrollSpy {
|
|||||||
|
|
||||||
_clear() {
|
_clear() {
|
||||||
[].slice.call(document.querySelectorAll(this._selector))
|
[].slice.call(document.querySelectorAll(this._selector))
|
||||||
.filter((node) => node.classList.contains(CLASS_NAME_ACTIVE))
|
.filter(node => node.classList.contains(CLASS_NAME_ACTIVE))
|
||||||
.forEach((node) => node.classList.remove(CLASS_NAME_ACTIVE))
|
.forEach(node => node.classList.remove(CLASS_NAME_ACTIVE))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
@@ -282,6 +285,7 @@ class ScrollSpy {
|
|||||||
if (typeof data[config] === 'undefined') {
|
if (typeof data[config] === 'undefined') {
|
||||||
throw new TypeError(`No method named "${config}"`)
|
throw new TypeError(`No method named "${config}"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
data[config]()
|
data[config]()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
+4
-3
@@ -135,9 +135,9 @@ class Tab {
|
|||||||
// Private
|
// Private
|
||||||
|
|
||||||
_activate(element, container, callback) {
|
_activate(element, container, callback) {
|
||||||
const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL')
|
const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ?
|
||||||
? $(container).find(SELECTOR_ACTIVE_UL)
|
$(container).find(SELECTOR_ACTIVE_UL) :
|
||||||
: $(container).children(SELECTOR_ACTIVE)
|
$(container).children(SELECTOR_ACTIVE)
|
||||||
|
|
||||||
const active = activeElements[0]
|
const active = activeElements[0]
|
||||||
const isTransitioning = callback && (active && $(active).hasClass(CLASS_NAME_FADE))
|
const isTransitioning = callback && (active && $(active).hasClass(CLASS_NAME_FADE))
|
||||||
@@ -220,6 +220,7 @@ class Tab {
|
|||||||
if (typeof data[config] === 'undefined') {
|
if (typeof data[config] === 'undefined') {
|
||||||
throw new TypeError(`No method named "${config}"`)
|
throw new TypeError(`No method named "${config}"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
data[config]()
|
data[config]()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ function allowedAttribute(attr, allowedAttributeList) {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
const regExp = allowedAttributeList.filter((attrRegex) => attrRegex instanceof RegExp)
|
const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp)
|
||||||
|
|
||||||
// Check if a regular expression validates the attribute.
|
// Check if a regular expression validates the attribute.
|
||||||
for (let i = 0, len = regExp.length; i < len; i++) {
|
for (let i = 0, len = regExp.length; i < len; i++) {
|
||||||
@@ -116,7 +116,7 @@ export function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
|
|||||||
const attributeList = [].slice.call(el.attributes)
|
const attributeList = [].slice.call(el.attributes)
|
||||||
const whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
|
const whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
|
||||||
|
|
||||||
attributeList.forEach((attr) => {
|
attributeList.forEach(attr => {
|
||||||
if (!allowedAttribute(attr, whitelistedAttributes)) {
|
if (!allowedAttribute(attr, whitelistedAttributes)) {
|
||||||
el.removeAttribute(attr.nodeName)
|
el.removeAttribute(attr.nodeName)
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-20
@@ -265,9 +265,9 @@ class Tooltip {
|
|||||||
$(tip).addClass(CLASS_NAME_FADE)
|
$(tip).addClass(CLASS_NAME_FADE)
|
||||||
}
|
}
|
||||||
|
|
||||||
const placement = typeof this.config.placement === 'function'
|
const placement = typeof this.config.placement === 'function' ?
|
||||||
? this.config.placement.call(this, tip, this.element)
|
this.config.placement.call(this, tip, this.element) :
|
||||||
: this.config.placement
|
this.config.placement
|
||||||
|
|
||||||
const attachment = this._getAttachment(placement)
|
const attachment = this._getAttachment(placement)
|
||||||
this.addAttachmentClass(attachment)
|
this.addAttachmentClass(attachment)
|
||||||
@@ -297,6 +297,7 @@ class Tooltip {
|
|||||||
if (this.config.animation) {
|
if (this.config.animation) {
|
||||||
this._fixTransition()
|
this._fixTransition()
|
||||||
}
|
}
|
||||||
|
|
||||||
const prevHoverState = this._hoverState
|
const prevHoverState = this._hoverState
|
||||||
this._hoverState = null
|
this._hoverState = null
|
||||||
|
|
||||||
@@ -426,9 +427,9 @@ class Tooltip {
|
|||||||
let title = this.element.getAttribute('data-original-title')
|
let title = this.element.getAttribute('data-original-title')
|
||||||
|
|
||||||
if (!title) {
|
if (!title) {
|
||||||
title = typeof this.config.title === 'function'
|
title = typeof this.config.title === 'function' ?
|
||||||
? this.config.title.call(this.element)
|
this.config.title.call(this.element) :
|
||||||
: this.config.title
|
this.config.title
|
||||||
}
|
}
|
||||||
|
|
||||||
return title
|
return title
|
||||||
@@ -451,12 +452,12 @@ class Tooltip {
|
|||||||
boundariesElement: this.config.boundary
|
boundariesElement: this.config.boundary
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onCreate: (data) => {
|
onCreate: data => {
|
||||||
if (data.originalPlacement !== data.placement) {
|
if (data.originalPlacement !== data.placement) {
|
||||||
this._handlePopperPlacementChange(data)
|
this._handlePopperPlacementChange(data)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUpdate: (data) => this._handlePopperPlacementChange(data)
|
onUpdate: data => this._handlePopperPlacementChange(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -469,7 +470,7 @@ class Tooltip {
|
|||||||
const offset = {}
|
const offset = {}
|
||||||
|
|
||||||
if (typeof this.config.offset === 'function') {
|
if (typeof this.config.offset === 'function') {
|
||||||
offset.fn = (data) => {
|
offset.fn = data => {
|
||||||
data.offsets = {
|
data.offsets = {
|
||||||
...data.offsets,
|
...data.offsets,
|
||||||
...this.config.offset(data.offsets, this.element) || {}
|
...this.config.offset(data.offsets, this.element) || {}
|
||||||
@@ -503,24 +504,24 @@ class Tooltip {
|
|||||||
_setListeners() {
|
_setListeners() {
|
||||||
const triggers = this.config.trigger.split(' ')
|
const triggers = this.config.trigger.split(' ')
|
||||||
|
|
||||||
triggers.forEach((trigger) => {
|
triggers.forEach(trigger => {
|
||||||
if (trigger === 'click') {
|
if (trigger === 'click') {
|
||||||
$(this.element).on(
|
$(this.element).on(
|
||||||
this.constructor.Event.CLICK,
|
this.constructor.Event.CLICK,
|
||||||
this.config.selector,
|
this.config.selector,
|
||||||
(event) => this.toggle(event)
|
event => this.toggle(event)
|
||||||
)
|
)
|
||||||
} else if (trigger !== TRIGGER_MANUAL) {
|
} else if (trigger !== TRIGGER_MANUAL) {
|
||||||
const eventIn = trigger === TRIGGER_HOVER
|
const eventIn = trigger === TRIGGER_HOVER ?
|
||||||
? this.constructor.Event.MOUSEENTER
|
this.constructor.Event.MOUSEENTER :
|
||||||
: this.constructor.Event.FOCUSIN
|
this.constructor.Event.FOCUSIN
|
||||||
const eventOut = trigger === TRIGGER_HOVER
|
const eventOut = trigger === TRIGGER_HOVER ?
|
||||||
? this.constructor.Event.MOUSELEAVE
|
this.constructor.Event.MOUSELEAVE :
|
||||||
: this.constructor.Event.FOCUSOUT
|
this.constructor.Event.FOCUSOUT
|
||||||
|
|
||||||
$(this.element)
|
$(this.element)
|
||||||
.on(eventIn, this.config.selector, (event) => this._enter(event))
|
.on(eventIn, this.config.selector, event => this._enter(event))
|
||||||
.on(eventOut, this.config.selector, (event) => this._leave(event))
|
.on(eventOut, this.config.selector, event => this._leave(event))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -647,7 +648,7 @@ class Tooltip {
|
|||||||
const dataAttributes = $(this.element).data()
|
const dataAttributes = $(this.element).data()
|
||||||
|
|
||||||
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]
|
||||||
}
|
}
|
||||||
@@ -750,6 +751,7 @@ class Tooltip {
|
|||||||
if (typeof data[config] === 'undefined') {
|
if (typeof data[config] === 'undefined') {
|
||||||
throw new TypeError(`No method named "${config}"`)
|
throw new TypeError(`No method named "${config}"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
data[config]()
|
data[config]()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
+5
-4
@@ -34,6 +34,7 @@ function getSpecialTransitionEndEvent() {
|
|||||||
if ($(event.target).is(this)) {
|
if ($(event.target).is(this)) {
|
||||||
return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params
|
return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,9 +72,9 @@ const Util = {
|
|||||||
|
|
||||||
getUID(prefix) {
|
getUID(prefix) {
|
||||||
do {
|
do {
|
||||||
// eslint-disable-next-line no-bitwise
|
|
||||||
prefix += ~~(Math.random() * MAX_UID) // "~~" acts like a faster Math.floor() here
|
prefix += ~~(Math.random() * MAX_UID) // "~~" acts like a faster Math.floor() here
|
||||||
} while (document.getElementById(prefix))
|
} while (document.getElementById(prefix))
|
||||||
|
|
||||||
return prefix
|
return prefix
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -87,7 +88,7 @@ const Util = {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return document.querySelector(selector) ? selector : null
|
return document.querySelector(selector) ? selector : null
|
||||||
} catch (err) {
|
} catch (_) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -138,8 +139,8 @@ const Util = {
|
|||||||
if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
|
if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
|
||||||
const expectedTypes = configTypes[property]
|
const expectedTypes = configTypes[property]
|
||||||
const value = config[property]
|
const value = config[property]
|
||||||
const valueType = value && Util.isElement(value)
|
const valueType = value && Util.isElement(value) ?
|
||||||
? 'element' : toType(value)
|
'element' : toType(value)
|
||||||
|
|
||||||
if (!new RegExp(expectedTypes).test(valueType)) {
|
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ conf.plugins = plugins
|
|||||||
conf.reporters = reporters
|
conf.reporters = reporters
|
||||||
conf.files = files
|
conf.files = files
|
||||||
|
|
||||||
module.exports = (karmaConfig) => {
|
module.exports = karmaConfig => {
|
||||||
// possible values: karmaConfig.LOG_DISABLE || karmaConfig.LOG_ERROR || karmaConfig.LOG_WARN || karmaConfig.LOG_INFO || karmaConfig.LOG_DEBUG
|
// possible values: karmaConfig.LOG_DISABLE || karmaConfig.LOG_ERROR || karmaConfig.LOG_WARN || karmaConfig.LOG_INFO || karmaConfig.LOG_DEBUG
|
||||||
conf.logLevel = karmaConfig.LOG_ERROR || karmaConfig.LOG_WARN
|
conf.logLevel = karmaConfig.LOG_ERROR || karmaConfig.LOG_WARN
|
||||||
karmaConfig.set(conf)
|
karmaConfig.set(conf)
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ $(function () {
|
|||||||
$el.bootstrapCarousel()
|
$el.bootstrapCarousel()
|
||||||
try {
|
try {
|
||||||
$el.bootstrapCarousel('noMethod')
|
$el.bootstrapCarousel('noMethod')
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
assert.strictEqual(error.message, 'No method named "noMethod"')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -89,8 +89,8 @@ $(function () {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$('<div/>').bootstrapCarousel(config)
|
$('<div/>').bootstrapCarousel(config)
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
message = err.message
|
message = error.message
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.ok(message === expectedMessage, 'correct error message')
|
assert.ok(message === expectedMessage, 'correct error message')
|
||||||
@@ -102,8 +102,8 @@ $(function () {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$('<div/>').bootstrapCarousel(config)
|
$('<div/>').bootstrapCarousel(config)
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
message = err.message
|
message = error.message
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.ok(message === expectedMessage, 'correct error message')
|
assert.ok(message === expectedMessage, 'correct error message')
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ $(function () {
|
|||||||
$el.bootstrapCollapse()
|
$el.bootstrapCollapse()
|
||||||
try {
|
try {
|
||||||
$el.bootstrapCollapse('noMethod')
|
$el.bootstrapCollapse('noMethod')
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
assert.strictEqual(error.message, 'No method named "noMethod"')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -830,7 +830,7 @@ $(function () {
|
|||||||
parent: $('.my-collapse')
|
parent: $('.my-collapse')
|
||||||
})
|
})
|
||||||
assert.ok(true, 'collapse correctly created')
|
assert.ok(true, 'collapse correctly created')
|
||||||
} catch (err) {
|
} catch (_) {
|
||||||
assert.ok(false, 'collapse not created')
|
assert.ok(false, 'collapse not created')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -851,7 +851,7 @@ $(function () {
|
|||||||
parent: $('.my-collapse')[0]
|
parent: $('.my-collapse')[0]
|
||||||
})
|
})
|
||||||
assert.ok(true, 'collapse correctly created')
|
assert.ok(true, 'collapse correctly created')
|
||||||
} catch (err) {
|
} catch (_) {
|
||||||
assert.ok(false, 'collapse not created')
|
assert.ok(false, 'collapse not created')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ $(function () {
|
|||||||
$el.bootstrapDropdown()
|
$el.bootstrapDropdown()
|
||||||
try {
|
try {
|
||||||
$el.bootstrapDropdown('noMethod')
|
$el.bootstrapDropdown('noMethod')
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
assert.strictEqual(error.message, 'No method named "noMethod"')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ $(function () {
|
|||||||
$el.bootstrapModal()
|
$el.bootstrapModal()
|
||||||
try {
|
try {
|
||||||
$el.bootstrapModal('noMethod')
|
$el.bootstrapModal('noMethod')
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
assert.strictEqual(error.message, 'No method named "noMethod"')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ $(function () {
|
|||||||
$el.bootstrapPopover()
|
$el.bootstrapPopover()
|
||||||
try {
|
try {
|
||||||
$el.bootstrapPopover('noMethod')
|
$el.bootstrapPopover('noMethod')
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
assert.strictEqual(error.message, 'No method named "noMethod"')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -369,8 +369,8 @@ $(function () {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$('<div data-toggle="popover" data-title="some title" data-content="@Johann-S" style="display: none"/>').bootstrapPopover('show')
|
$('<div data-toggle="popover" data-title="some title" data-content="@Johann-S" style="display: none"/>').bootstrapPopover('show')
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
assert.strictEqual(err.message, 'Please use show on visible elements')
|
assert.strictEqual(error.message, 'Please use show on visible elements')
|
||||||
done()
|
done()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ $(function () {
|
|||||||
$el.bootstrapScrollspy()
|
$el.bootstrapScrollspy()
|
||||||
try {
|
try {
|
||||||
$el.bootstrapScrollspy('noMethod')
|
$el.bootstrapScrollspy('noMethod')
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
assert.strictEqual(error.message, 'No method named "noMethod"')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ $(function () {
|
|||||||
$el.bootstrapTab()
|
$el.bootstrapTab()
|
||||||
try {
|
try {
|
||||||
$el.bootstrapTab('noMethod')
|
$el.bootstrapTab('noMethod')
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
assert.strictEqual(error.message, 'No method named "noMethod"')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ $(function () {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$el.bootstrapToast('noMethod')
|
$el.bootstrapToast('noMethod')
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
assert.strictEqual(error.message, 'No method named "noMethod"')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ $(function () {
|
|||||||
$el.bootstrapTooltip()
|
$el.bootstrapTooltip()
|
||||||
try {
|
try {
|
||||||
$el.bootstrapTooltip('noMethod')
|
$el.bootstrapTooltip('noMethod')
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
assert.strictEqual(err.message, 'No method named "noMethod"')
|
assert.strictEqual(error.message, 'No method named "noMethod"')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -231,8 +231,8 @@ $(function () {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$('<div title="tooltip title" style="display: none"/>').bootstrapTooltip('show')
|
$('<div title="tooltip title" style="display: none"/>').bootstrapTooltip('show')
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
assert.strictEqual(err.message, 'Please use show on visible elements')
|
assert.strictEqual(error.message, 'Please use show on visible elements')
|
||||||
done()
|
done()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -336,7 +336,7 @@ $(function () {
|
|||||||
assert.expect(7)
|
assert.expect(7)
|
||||||
var $tooltip = $('<div/>')
|
var $tooltip = $('<div/>')
|
||||||
.bootstrapTooltip()
|
.bootstrapTooltip()
|
||||||
.on('click.foo', function () {}) // eslint-disable-line no-empty-function
|
.on('click.foo', function () {})
|
||||||
|
|
||||||
assert.ok($tooltip.data('bs.tooltip'), 'tooltip has data')
|
assert.ok($tooltip.data('bs.tooltip'), 'tooltip has data')
|
||||||
assert.ok($._data($tooltip[0], 'events').mouseover && $._data($tooltip[0], 'events').mouseout, 'tooltip has hover events')
|
assert.ok($._data($tooltip[0], 'events').mouseover && $._data($tooltip[0], 'events').mouseout, 'tooltip has hover events')
|
||||||
@@ -561,7 +561,7 @@ $(function () {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$tooltip.bootstrapTooltip('show')
|
$tooltip.bootstrapTooltip('show')
|
||||||
} catch (err) {
|
} catch (_) {
|
||||||
passed = false
|
passed = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ $(function () {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Util.typeCheckConfig(namePlugin, config, defaultType)
|
Util.typeCheckConfig(namePlugin, config, defaultType)
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
assert.strictEqual(err.message, 'COLLAPSE: Option "parent" provided type "number" but expected type "(string|element)".')
|
assert.strictEqual(error.message, 'COLLAPSE: Option "parent" provided type "number" but expected type "(string|element)".')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -109,4 +109,4 @@
|
|||||||
|
|
||||||
bsCustomFileInput.init()
|
bsCustomFileInput.init()
|
||||||
})
|
})
|
||||||
}(jQuery))
|
})(jQuery)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
if (groups === null) {
|
if (groups === null) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
var ieVersionNum = parseInt(groups[1], 10)
|
var ieVersionNum = parseInt(groups[1], 10)
|
||||||
var ieMajorVersion = Math.floor(ieVersionNum)
|
var ieMajorVersion = Math.floor(ieVersionNum)
|
||||||
return ieMajorVersion
|
return ieMajorVersion
|
||||||
@@ -24,9 +25,11 @@
|
|||||||
if (typeof jscriptVersion === 'undefined') {
|
if (typeof jscriptVersion === 'undefined') {
|
||||||
return 11 // IE11+ not in emulation mode
|
return 11 // IE11+ not in emulation mode
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jscriptVersion < 9) {
|
if (jscriptVersion < 9) {
|
||||||
return 8 // IE8 (or lower; haven't tested on IE<8)
|
return 8 // IE8 (or lower; haven't tested on IE<8)
|
||||||
}
|
}
|
||||||
|
|
||||||
return jscriptVersion // IE9 or IE10 in any mode, or IE11 in non-IE11 mode
|
return jscriptVersion // IE9 or IE10 in any mode, or IE11 in non-IE11 mode
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,14 +37,16 @@
|
|||||||
if (ua.indexOf('Opera') > -1 || ua.indexOf('Presto') > -1) {
|
if (ua.indexOf('Opera') > -1 || ua.indexOf('Presto') > -1) {
|
||||||
return // Opera, which might pretend to be IE
|
return // Opera, which might pretend to be IE
|
||||||
}
|
}
|
||||||
|
|
||||||
var emulated = emulatedIEMajorVersion()
|
var emulated = emulatedIEMajorVersion()
|
||||||
if (emulated === null) {
|
if (emulated === null) {
|
||||||
return // Not IE
|
return // Not IE
|
||||||
}
|
}
|
||||||
|
|
||||||
var nonEmulated = actualNonEmulatedIEMajorVersion()
|
var nonEmulated = actualNonEmulatedIEMajorVersion()
|
||||||
|
|
||||||
if (emulated !== nonEmulated) {
|
if (emulated !== nonEmulated) {
|
||||||
// eslint-disable-next-line no-alert
|
// eslint-disable-next-line no-alert
|
||||||
window.alert('WARNING: You appear to be using IE' + nonEmulated + ' in IE' + emulated + ' emulation mode.\nIE emulation modes can behave significantly differently from ACTUAL older versions of IE.\nPLEASE DON\'T FILE BOOTSTRAP BUGS based on testing in IE emulation modes!')
|
window.alert('WARNING: You appear to be using IE' + nonEmulated + ' in IE' + emulated + ' emulation mode.\nIE emulation modes can behave significantly differently from ACTUAL older versions of IE.\nPLEASE DON\'T FILE BOOTSTRAP BUGS based on testing in IE emulation modes!')
|
||||||
}
|
}
|
||||||
}())
|
})()
|
||||||
|
|||||||
@@ -37,12 +37,12 @@
|
|||||||
var currentUrl = getOrigin()
|
var currentUrl = getOrigin()
|
||||||
var liveUrl = 'https://getbootstrap.com/'
|
var liveUrl = 'https://getbootstrap.com/'
|
||||||
|
|
||||||
hit.url = currentUrl.lastIndexOf(liveUrl, 0) === 0
|
hit.url = currentUrl.lastIndexOf(liveUrl, 0) === 0 ?
|
||||||
// On production, return the result as is
|
// On production, return the result as is
|
||||||
? hit.url
|
hit.url :
|
||||||
// On development or Netlify, replace `hit.url` with a trailing slash,
|
// On development or Netlify, replace `hit.url` with a trailing slash,
|
||||||
// so that the result link is relative to the server root
|
// so that the result link is relative to the server root
|
||||||
: hit.url.replace(liveUrl, '/')
|
hit.url.replace(liveUrl, '/')
|
||||||
|
|
||||||
// Prevent jumping to first header
|
// Prevent jumping to first header
|
||||||
if (hit.anchor === 'content') {
|
if (hit.anchor === 'content') {
|
||||||
@@ -56,4 +56,4 @@
|
|||||||
// Set debug to `true` if you want to inspect the dropdown
|
// Set debug to `true` if you want to inspect the dropdown
|
||||||
debug: false
|
debug: false
|
||||||
})
|
})
|
||||||
}())
|
})()
|
||||||
|
|||||||
@@ -13,8 +13,9 @@
|
|||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
}
|
}
|
||||||
|
|
||||||
form.classList.add('was-validated')
|
form.classList.add('was-validated')
|
||||||
}, false)
|
}, false)
|
||||||
})
|
})
|
||||||
}, false)
|
}, false)
|
||||||
}())
|
})()
|
||||||
|
|||||||
@@ -50,4 +50,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}())
|
})()
|
||||||
|
|||||||
Reference in New Issue
Block a user