aboutsummaryrefslogtreecommitdiff
path: root/js/src/util
diff options
context:
space:
mode:
authorJohann-S <[email protected]>2020-03-25 15:35:02 +0100
committerGitHub <[email protected]>2020-03-25 16:35:02 +0200
commit26d86fce2a10f5c9e295b0acf5e6381ff21368b4 (patch)
tree63ed06cb159ad7b625aa6b4c8d7460a1a269db43 /js/src/util
parent98c45986962f8ab16bc630722e96dbfb048079b3 (diff)
downloadbootstrap-26d86fce2a10f5c9e295b0acf5e6381ff21368b4.tar.xz
bootstrap-26d86fce2a10f5c9e295b0acf5e6381ff21368b4.zip
fix: remove make array util function (#30430)
Diffstat (limited to 'js/src/util')
-rw-r--r--js/src/util/index.js9
-rw-r--r--js/src/util/sanitizer.js6
2 files changed, 2 insertions, 13 deletions
diff --git a/js/src/util/index.js b/js/src/util/index.js
index 001201b4b..c9331e217 100644
--- a/js/src/util/index.js
+++ b/js/src/util/index.js
@@ -127,14 +127,6 @@ const typeCheckConfig = (componentName, config, configTypes) => {
})
}
-const makeArray = nodeList => {
- if (!nodeList) {
- return []
- }
-
- return [].slice.call(nodeList)
-}
-
const isVisible = element => {
if (!element) {
return false
@@ -200,7 +192,6 @@ export {
isElement,
emulateTransitionEnd,
typeCheckConfig,
- makeArray,
isVisible,
findShadowRoot,
noop,
diff --git a/js/src/util/sanitizer.js b/js/src/util/sanitizer.js
index f86cbe88a..0f896b2c4 100644
--- a/js/src/util/sanitizer.js
+++ b/js/src/util/sanitizer.js
@@ -5,8 +5,6 @@
* --------------------------------------------------------------------------
*/
-import { makeArray } from './index'
-
const uriAttrs = [
'background',
'cite',
@@ -103,7 +101,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 = makeArray(createdDocument.body.querySelectorAll('*'))
+ const elements = [].concat(...createdDocument.body.querySelectorAll('*'))
for (let i = 0, len = elements.length; i < len; i++) {
const el = elements[i]
@@ -115,7 +113,7 @@ export function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
continue
}
- const attributeList = makeArray(el.attributes)
+ const attributeList = [].concat(...el.attributes)
const whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
attributeList.forEach(attr => {