Skip to content

Conversation

@adrichey
Copy link
Contributor

This fixes a bug where elements without a target offsetParent were throwing uncaught errors when trying to determine if a click event originated from an info panel element or not.

let isInfoPanel = false
if (e.target.offsetParent !== null) {
isInfoPanel = e.target.offsetParent.className.includes('infoPanel')
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! However, I prefer this way

  const offsetParent = e.target.offsetParent
  const isInfoPanel = offsetParent !== null
    ? offsetParent.className.includes('infoPanel')
    : false

How about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I will update that in a bit. The only reason I did it the way I did is for readability. Ternary statement it is!

…ll" bug that appears when creating folders (coding style adjustments)
@asmsuechan asmsuechan merged commit c429fc6 into BoostIO:master Oct 13, 2017
@asmsuechan
Copy link
Contributor

Thank you so much!

@kazup01
Copy link
Member

kazup01 commented Oct 13, 2017

Thanks @adrichey !

@adrichey
Copy link
Contributor Author

Anytime! Glad to assist!

@kohei-takata kohei-takata mentioned this pull request Oct 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants