Skip to content

Commit

Permalink
fix(isCapture): better guard that preserves logic
Browse files Browse the repository at this point in the history
  • Loading branch information
aronhelser committed Jun 4, 2018
1 parent 99bf5ec commit 28b8493
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/decorators/isCapture.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

export default function (target) {
target.prototype.isCapture = function (currentTarget) {
if (!currentTarget) return false
const dataIsCapture = currentTarget.getAttribute('data-iscapture')
return dataIsCapture && dataIsCapture === 'true' || this.props.isCapture || false
return (currentTarget && currentTarget.getAttribute('data-iscapture') === 'true') || this.props.isCapture || false
}
}
4 changes: 1 addition & 3 deletions standalone/react-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -1349,9 +1349,7 @@ Object.defineProperty(exports, "__esModule", {

exports.default = function (target) {
target.prototype.isCapture = function (currentTarget) {
if (!currentTarget) return false;
var dataIsCapture = currentTarget.getAttribute('data-iscapture');
return dataIsCapture && dataIsCapture === 'true' || this.props.isCapture || false;
return currentTarget && currentTarget.getAttribute('data-iscapture') === 'true' || this.props.isCapture || false;
};
};

Expand Down
Loading

0 comments on commit 28b8493

Please sign in to comment.