0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-28 20:52:21 +01:00

Simplify checks.

This commit is contained in:
XhmikosR 2019-02-13 21:40:15 +02:00
parent 4b7c058a25
commit 30861cbc6d
3 changed files with 6 additions and 7 deletions

View File

@ -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
}

View File

@ -76,7 +76,7 @@ const Manipulator = {
},
toggleClass(element, className) {
if (typeof element === 'undefined' || element === null) {
if (!element) {
return
}

View File

@ -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
}