diff options
author | XhmikosR <xhmikosr@gmail.com> | 2019-02-13 22:40:15 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2019-02-20 23:05:45 +0300 |
commit | 30861cbc6d450d70e646e2b1b35223f14d3d6973 (patch) | |
tree | a71db0502eb15e1bdc4e34d33148a231bad9aac3 /js | |
parent | 4b7c058a252b3f064d7508a70f4e783765921eea (diff) |
Simplify checks.
Diffstat (limited to 'js')
-rw-r--r-- | js/src/dom/eventHandler.js | 7 | ||||
-rw-r--r-- | js/src/dom/manipulator.js | 2 | ||||
-rw-r--r-- | js/src/util.js | 4 |
3 files changed, 6 insertions, 7 deletions
diff --git a/js/src/dom/eventHandler.js b/js/src/dom/eventHandler.js index c3d4f000a3..9049acfb62 100644 --- a/js/src/dom/eventHandler.js +++ b/js/src/dom/eventHandler.js @@ -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 } diff --git a/js/src/dom/manipulator.js b/js/src/dom/manipulator.js index 5210f8b2c6..31d0252c65 100644 --- a/js/src/dom/manipulator.js +++ b/js/src/dom/manipulator.js @@ -76,7 +76,7 @@ const Manipulator = { }, toggleClass(element, className) { - if (typeof element === 'undefined' || element === null) { + if (!element) { return } diff --git a/js/src/util.js b/js/src/util.js index 5467b9dab5..8b6226f61c 100644 --- a/js/src/util.js +++ b/js/src/util.js @@ -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 } |