Commit 68e6de42 authored by XhmikosR's avatar XhmikosR
Browse files

Use `Util.makeArray()`.

parent 9fda96e1
5 merge requests!31948Examples/Floating-labels: fix bad behavior with autofill,!30064test,!29779Responsive sizing,!28882fix custom-select-indicator in IE10,!28721Hot test
Showing with 16 additions and 14 deletions
+16 -14
...@@ -320,7 +320,7 @@ class Carousel { ...@@ -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 { ...@@ -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)
......
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' ...@@ -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 { ...@@ -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
......
/**
* --------------------------------------------------------------------------
* 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' ...@@ -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 @@ ...@@ -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) { ...@@ -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) { ...@@ -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) => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment