Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
b9f7668c
Commit
b9f7668c
authored
4 years ago
by
XhmikosR
Browse files
Options
Download
Email Patches
Plain Diff
Switch to `String.includes()`
parent
470e99ed
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.eslintrc.json
+0
-1
.eslintrc.json
js/src/dom/event-handler.js
+4
-4
js/src/dom/event-handler.js
js/src/tooltip.js
+1
-1
js/src/tooltip.js
js/src/util/sanitizer.js
+3
-3
js/src/util/sanitizer.js
site/.eslintrc.json
+0
-1
site/.eslintrc.json
with
8 additions
and
10 deletions
+8
-10
.eslintrc.json
+
0
-
1
View file @
b9f7668c
...
@@ -51,7 +51,6 @@
...
@@ -51,7 +51,6 @@
"unicorn/no-useless-undefined"
:
"off"
,
"unicorn/no-useless-undefined"
:
"off"
,
"unicorn/prefer-array-find"
:
"off"
,
"unicorn/prefer-array-find"
:
"off"
,
"unicorn/prefer-dataset"
:
"off"
,
"unicorn/prefer-dataset"
:
"off"
,
"unicorn/prefer-includes"
:
"off"
,
"unicorn/prefer-node-append"
:
"off"
,
"unicorn/prefer-node-append"
:
"off"
,
"unicorn/prefer-node-remove"
:
"off"
,
"unicorn/prefer-node-remove"
:
"off"
,
"unicorn/prefer-number-properties"
:
"off"
,
"unicorn/prefer-number-properties"
:
"off"
,
...
...
This diff is collapsed.
Click to expand it.
js/src/dom/event-handler.js
+
4
-
4
View file @
b9f7668c
...
@@ -151,7 +151,7 @@ function normalizeParams(originalTypeEvent, handler, delegationFn) {
...
@@ -151,7 +151,7 @@ function normalizeParams(originalTypeEvent, handler, delegationFn) {
typeEvent
=
custom
typeEvent
=
custom
}
}
const
isNative
=
nativeEvents
.
in
dexOf
(
typeEvent
)
>
-
1
const
isNative
=
nativeEvents
.
in
cludes
(
typeEvent
)
if
(
!
isNative
)
{
if
(
!
isNative
)
{
typeEvent
=
originalTypeEvent
typeEvent
=
originalTypeEvent
...
@@ -210,7 +210,7 @@ function removeNamespacedHandlers(element, events, typeEvent, namespace) {
...
@@ -210,7 +210,7 @@ function removeNamespacedHandlers(element, events, typeEvent, namespace) {
const
storeElementEvent
=
events
[
typeEvent
]
||
{}
const
storeElementEvent
=
events
[
typeEvent
]
||
{}
Object
.
keys
(
storeElementEvent
).
forEach
(
handlerKey
=>
{
Object
.
keys
(
storeElementEvent
).
forEach
(
handlerKey
=>
{
if
(
handlerKey
.
in
dexOf
(
namespace
)
>
-
1
)
{
if
(
handlerKey
.
in
cludes
(
namespace
))
{
const
event
=
storeElementEvent
[
handlerKey
]
const
event
=
storeElementEvent
[
handlerKey
]
removeHandler
(
element
,
events
,
typeEvent
,
event
.
originalHandler
,
event
.
delegationSelector
)
removeHandler
(
element
,
events
,
typeEvent
,
event
.
originalHandler
,
event
.
delegationSelector
)
...
@@ -257,7 +257,7 @@ const EventHandler = {
...
@@ -257,7 +257,7 @@ const EventHandler = {
Object
.
keys
(
storeElementEvent
).
forEach
(
keyHandlers
=>
{
Object
.
keys
(
storeElementEvent
).
forEach
(
keyHandlers
=>
{
const
handlerKey
=
keyHandlers
.
replace
(
stripUidRegex
,
''
)
const
handlerKey
=
keyHandlers
.
replace
(
stripUidRegex
,
''
)
if
(
!
inNamespace
||
originalTypeEvent
.
in
dexOf
(
handlerKey
)
>
-
1
)
{
if
(
!
inNamespace
||
originalTypeEvent
.
in
cludes
(
handlerKey
))
{
const
event
=
storeElementEvent
[
keyHandlers
]
const
event
=
storeElementEvent
[
keyHandlers
]
removeHandler
(
element
,
events
,
typeEvent
,
event
.
originalHandler
,
event
.
delegationSelector
)
removeHandler
(
element
,
events
,
typeEvent
,
event
.
originalHandler
,
event
.
delegationSelector
)
...
@@ -273,7 +273,7 @@ const EventHandler = {
...
@@ -273,7 +273,7 @@ const EventHandler = {
const
$
=
getjQuery
()
const
$
=
getjQuery
()
const
typeEvent
=
event
.
replace
(
stripNameRegex
,
''
)
const
typeEvent
=
event
.
replace
(
stripNameRegex
,
''
)
const
inNamespace
=
event
!==
typeEvent
const
inNamespace
=
event
!==
typeEvent
const
isNative
=
nativeEvents
.
in
dexOf
(
typeEvent
)
>
-
1
const
isNative
=
nativeEvents
.
in
cludes
(
typeEvent
)
let
jQueryEvent
let
jQueryEvent
let
bubbles
=
true
let
bubbles
=
true
...
...
This diff is collapsed.
Click to expand it.
js/src/tooltip.js
+
1
-
1
View file @
b9f7668c
...
@@ -679,7 +679,7 @@ class Tooltip {
...
@@ -679,7 +679,7 @@ class Tooltip {
const
dataAttributes
=
Manipulator
.
getDataAttributes
(
this
.
element
)
const
dataAttributes
=
Manipulator
.
getDataAttributes
(
this
.
element
)
Object
.
keys
(
dataAttributes
).
forEach
(
dataAttr
=>
{
Object
.
keys
(
dataAttributes
).
forEach
(
dataAttr
=>
{
if
(
DISALLOWED_ATTRIBUTES
.
in
dexOf
(
dataAttr
)
!==
-
1
)
{
if
(
DISALLOWED_ATTRIBUTES
.
in
cludes
(
dataAttr
))
{
delete
dataAttributes
[
dataAttr
]
delete
dataAttributes
[
dataAttr
]
}
}
})
})
...
...
This diff is collapsed.
Click to expand it.
js/src/util/sanitizer.js
+
3
-
3
View file @
b9f7668c
...
@@ -35,8 +35,8 @@ const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|vid
...
@@ -35,8 +35,8 @@ const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|vid
const
allowedAttribute
=
(
attr
,
allowedAttributeList
)
=>
{
const
allowedAttribute
=
(
attr
,
allowedAttributeList
)
=>
{
const
attrName
=
attr
.
nodeName
.
toLowerCase
()
const
attrName
=
attr
.
nodeName
.
toLowerCase
()
if
(
allowedAttributeList
.
in
dexOf
(
attrName
)
!==
-
1
)
{
if
(
allowedAttributeList
.
in
cludes
(
attrName
))
{
if
(
uriAttrs
.
in
dexOf
(
attrName
)
!==
-
1
)
{
if
(
uriAttrs
.
in
cludes
(
attrName
))
{
return
Boolean
(
attr
.
nodeValue
.
match
(
SAFE_URL_PATTERN
)
||
attr
.
nodeValue
.
match
(
DATA_URL_PATTERN
))
return
Boolean
(
attr
.
nodeValue
.
match
(
SAFE_URL_PATTERN
)
||
attr
.
nodeValue
.
match
(
DATA_URL_PATTERN
))
}
}
...
@@ -107,7 +107,7 @@ export function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
...
@@ -107,7 +107,7 @@ export function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
const
el
=
elements
[
i
]
const
el
=
elements
[
i
]
const
elName
=
el
.
nodeName
.
toLowerCase
()
const
elName
=
el
.
nodeName
.
toLowerCase
()
if
(
allowlistKeys
.
in
dexOf
(
elName
)
===
-
1
)
{
if
(
!
allowlistKeys
.
in
cludes
(
elName
))
{
el
.
parentNode
.
removeChild
(
el
)
el
.
parentNode
.
removeChild
(
el
)
continue
continue
...
...
This diff is collapsed.
Click to expand it.
site/.eslintrc.json
+
0
-
1
View file @
b9f7668c
...
@@ -36,7 +36,6 @@
...
@@ -36,7 +36,6 @@
"unicorn/no-for-loop"
:
"off"
,
"unicorn/no-for-loop"
:
"off"
,
"unicorn/no-null"
:
"off"
,
"unicorn/no-null"
:
"off"
,
"unicorn/prefer-dataset"
:
"off"
,
"unicorn/prefer-dataset"
:
"off"
,
"unicorn/prefer-includes"
:
"off"
,
"unicorn/prefer-node-append"
:
"off"
,
"unicorn/prefer-node-append"
:
"off"
,
"unicorn/prefer-query-selector"
:
"off"
,
"unicorn/prefer-query-selector"
:
"off"
,
"unicorn/prevent-abbreviations"
:
"off"
"unicorn/prevent-abbreviations"
:
"off"
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment