Skip to content

Commit

Permalink
Simplify targets.length test
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Jan 11, 2017
1 parent 68de8f5 commit 89d2dcb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/src/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion js/src/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 89d2dcb

Please sign in to comment.