Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js/src/util
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2020-05-02 16:56:23 +0300
committerXhmikosR <xhmikosr@gmail.com>2020-11-14 16:54:50 +0300
commit6d7bc54d222709275b0eb73bd6b974509332247a (patch)
tree311222b691df1d7d6b237cd6fc74bae721911cd2 /js/src/util
parent2e758f64cf7da4a8612992a027704d9f10686b20 (diff)
Switch to `Set#has()`
Diffstat (limited to 'js/src/util')
-rw-r--r--js/src/util/sanitizer.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/js/src/util/sanitizer.js b/js/src/util/sanitizer.js
index 27c8dcfb6a..68469285ab 100644
--- a/js/src/util/sanitizer.js
+++ b/js/src/util/sanitizer.js
@@ -5,7 +5,7 @@
* --------------------------------------------------------------------------
*/
-const uriAttrs = [
+const uriAttrs = new Set([
'background',
'cite',
'href',
@@ -14,7 +14,7 @@ const uriAttrs = [
'poster',
'src',
'xlink:href'
-]
+])
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
@@ -36,7 +36,7 @@ const allowedAttribute = (attr, allowedAttributeList) => {
const attrName = attr.nodeName.toLowerCase()
if (allowedAttributeList.includes(attrName)) {
- if (uriAttrs.includes(attrName)) {
+ if (uriAttrs.has(attrName)) {
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
}