diff --git a/js/src/alert.js b/js/src/alert.js index bf4eec6f6e4c..4e29be07fb82 100644 --- a/js/src/alert.js +++ b/js/src/alert.js @@ -87,7 +87,7 @@ const Alert = (($) => { _getRootElement(element) { const targets = Util.getTargets(element) - return targets && targets.length > 0 ? targets[0] : $(element).closest(`.${ClassName.ALERT}`)[0] + return targets && targets.length ? targets[0] : $(element).closest(`.${ClassName.ALERT}`)[0] } _triggerCloseEvent(element) { diff --git a/js/src/dropdown.js b/js/src/dropdown.js index 9b924a935924..c0ed46ef81ce 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -203,7 +203,7 @@ const Dropdown = (($) => { static _getParentFromElement(element) { const targets = Util.getTargets(element) - return targets && targets.length > 0 ? targets[0] : element.parentNode + return targets && targets.length ? targets[0] : element.parentNode } static _dataApiKeydownHandler(event) {