mirror of https://github.com/twbs/bootstrap.git
Use `Util.makeArray()`.
This commit is contained in:
parent
9fda96e197
commit
68e6de42ec
|
@ -320,7 +320,7 @@ class Carousel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[].slice.call(SelectorEngine.find(Selector.ITEM_IMG, this._element)).forEach((itemImg) => {
|
Util.makeArray(SelectorEngine.find(Selector.ITEM_IMG, this._element)).forEach((itemImg) => {
|
||||||
EventHandler.on(itemImg, Event.DRAG_START, (e) => e.preventDefault())
|
EventHandler.on(itemImg, Event.DRAG_START, (e) => e.preventDefault())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ class Carousel {
|
||||||
|
|
||||||
_getItemIndex(element) {
|
_getItemIndex(element) {
|
||||||
this._items = element && element.parentNode
|
this._items = element && element.parentNode
|
||||||
? [].slice.call(SelectorEngine.find(Selector.ITEM, element.parentNode))
|
? Util.makeArray(SelectorEngine.find(Selector.ITEM, element.parentNode))
|
||||||
: []
|
: []
|
||||||
|
|
||||||
return this._items.indexOf(element)
|
return this._items.indexOf(element)
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import Util from '../util'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v4.3.1): dom/polyfill.js
|
* Bootstrap (v4.3.1): dom/polyfill.js
|
||||||
|
@ -7,6 +5,8 @@ import Util from '../util'
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import Util from '../util'
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
const Polyfill = (() => {
|
const Polyfill = (() => {
|
||||||
// MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
|
// MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
|
||||||
|
|
|
@ -482,7 +482,7 @@ class Dropdown {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const items = [].slice.call(parent.querySelectorAll(Selector.VISIBLE_ITEMS))
|
const items = Util.makeArray(parent.querySelectorAll(Selector.VISIBLE_ITEMS))
|
||||||
|
|
||||||
if (!items.length) {
|
if (!items.length) {
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
import Alert from './alert'
|
import Alert from './alert'
|
||||||
import Button from './button'
|
import Button from './button'
|
||||||
import Carousel from './carousel'
|
import Carousel from './carousel'
|
||||||
|
@ -11,13 +18,6 @@ import Toast from './toast'
|
||||||
import Tooltip from './tooltip'
|
import Tooltip from './tooltip'
|
||||||
import Util from './util'
|
import Util from './util'
|
||||||
|
|
||||||
/**
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
* Bootstrap (v4.3.1): index.js
|
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Util,
|
Util,
|
||||||
Alert,
|
Alert,
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import Util from '../util'
|
||||||
|
|
||||||
const uriAttrs = [
|
const uriAttrs = [
|
||||||
'background',
|
'background',
|
||||||
'cite',
|
'cite',
|
||||||
|
@ -101,7 +103,7 @@ export function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
|
||||||
const domParser = new window.DOMParser()
|
const domParser = new window.DOMParser()
|
||||||
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html')
|
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html')
|
||||||
const whitelistKeys = Object.keys(whiteList)
|
const whitelistKeys = Object.keys(whiteList)
|
||||||
const elements = [].slice.call(createdDocument.body.querySelectorAll('*'))
|
const elements = Util.makeArray(createdDocument.body.querySelectorAll('*'))
|
||||||
|
|
||||||
for (let i = 0, len = elements.length; i < len; i++) {
|
for (let i = 0, len = elements.length; i < len; i++) {
|
||||||
const el = elements[i]
|
const el = elements[i]
|
||||||
|
@ -113,7 +115,7 @@ export function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
const attributeList = [].slice.call(el.attributes)
|
const attributeList = Util.makeArray(el.attributes)
|
||||||
const whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
|
const whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
|
||||||
|
|
||||||
attributeList.forEach((attr) => {
|
attributeList.forEach((attr) => {
|
||||||
|
|
Loading…
Reference in New Issue