mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-28 20:52:21 +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) {
|
||||
if (typeof originalTypeEvent !== 'string' || (typeof element === 'undefined' || element === null)) {
|
||||
if (typeof originalTypeEvent !== 'string' || !element) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ const EventHandler = {
|
||||
},
|
||||
|
||||
off(element, originalTypeEvent, handler, delegationFn) {
|
||||
if (typeof originalTypeEvent !== 'string' || (typeof element === 'undefined' || element === null)) {
|
||||
if (typeof originalTypeEvent !== 'string' || !element) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -243,8 +243,7 @@ const EventHandler = {
|
||||
},
|
||||
|
||||
trigger(element, event, args) {
|
||||
if (typeof event !== 'string' ||
|
||||
(typeof element === 'undefined' || element === null)) {
|
||||
if (typeof event !== 'string' || !element) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ const Manipulator = {
|
||||
},
|
||||
|
||||
toggleClass(element, className) {
|
||||
if (typeof element === 'undefined' || element === null) {
|
||||
if (!element) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ const Util = {
|
||||
},
|
||||
|
||||
makeArray(nodeList) {
|
||||
if (typeof nodeList === 'undefined' || nodeList === null) {
|
||||
if (!nodeList) {
|
||||
return []
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ const Util = {
|
||||
},
|
||||
|
||||
isVisible(element) {
|
||||
if (typeof element === 'undefined' || element === null) {
|
||||
if (!element) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user