mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-29 21:52:22 +01:00
Simplify checks.
This commit is contained in:
parent
4b7c058a25
commit
30861cbc6d
@ -132,7 +132,7 @@ function normalizeParams(originalTypeEvent, handler, delegationFn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
|
function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
|
||||||
if (typeof originalTypeEvent !== 'string' || (typeof element === 'undefined' || element === null)) {
|
if (typeof originalTypeEvent !== 'string' || !element) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ const EventHandler = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
off(element, originalTypeEvent, handler, delegationFn) {
|
off(element, originalTypeEvent, handler, delegationFn) {
|
||||||
if (typeof originalTypeEvent !== 'string' || (typeof element === 'undefined' || element === null)) {
|
if (typeof originalTypeEvent !== 'string' || !element) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,8 +243,7 @@ const EventHandler = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
trigger(element, event, args) {
|
trigger(element, event, args) {
|
||||||
if (typeof event !== 'string' ||
|
if (typeof event !== 'string' || !element) {
|
||||||
(typeof element === 'undefined' || element === null)) {
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ const Manipulator = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
toggleClass(element, className) {
|
toggleClass(element, className) {
|
||||||
if (typeof element === 'undefined' || element === null) {
|
if (!element) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ const Util = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
makeArray(nodeList) {
|
makeArray(nodeList) {
|
||||||
if (typeof nodeList === 'undefined' || nodeList === null) {
|
if (!nodeList) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ const Util = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
isVisible(element) {
|
isVisible(element) {
|
||||||
if (typeof element === 'undefined' || element === null) {
|
if (!element) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user