0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00

Use Util.makeArray().

This commit is contained in:
XhmikosR 2019-02-19 23:52:04 +02:00
parent 9fda96e197
commit 68e6de42ec
5 changed files with 16 additions and 14 deletions

View File

@ -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())
})
@ -356,7 +356,7 @@ class Carousel {
_getItemIndex(element) {
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)

View File

@ -1,5 +1,3 @@
import Util from '../util'
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.3.1): dom/polyfill.js
@ -7,6 +5,8 @@ import Util from '../util'
* --------------------------------------------------------------------------
*/
import Util from '../util'
/* istanbul ignore next */
const Polyfill = (() => {
// MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached

View File

@ -482,7 +482,7 @@ class Dropdown {
return
}
const items = [].slice.call(parent.querySelectorAll(Selector.VISIBLE_ITEMS))
const items = Util.makeArray(parent.querySelectorAll(Selector.VISIBLE_ITEMS))
if (!items.length) {
return

View File

@ -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 Button from './button'
import Carousel from './carousel'
@ -11,13 +18,6 @@ import Toast from './toast'
import Tooltip from './tooltip'
import Util from './util'
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.3.1): index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
export {
Util,
Alert,

View File

@ -5,6 +5,8 @@
* --------------------------------------------------------------------------
*/
import Util from '../util'
const uriAttrs = [
'background',
'cite',
@ -101,7 +103,7 @@ export function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
const domParser = new window.DOMParser()
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html')
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++) {
const el = elements[i]
@ -113,7 +115,7 @@ export function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
continue
}
const attributeList = [].slice.call(el.attributes)
const attributeList = Util.makeArray(el.attributes)
const whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
attributeList.forEach((attr) => {