Skip to content

Commit 28b8493

Browse files
committed
fix(isCapture): better guard that preserves logic
1 parent 99bf5ec commit 28b8493

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/decorators/isCapture.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
export default function (target) {
66
target.prototype.isCapture = function (currentTarget) {
7-
if (!currentTarget) return false
8-
const dataIsCapture = currentTarget.getAttribute('data-iscapture')
9-
return dataIsCapture && dataIsCapture === 'true' || this.props.isCapture || false
7+
return (currentTarget && currentTarget.getAttribute('data-iscapture') === 'true') || this.props.isCapture || false
108
}
119
}

standalone/react-tooltip.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1349,9 +1349,7 @@ Object.defineProperty(exports, "__esModule", {
13491349

13501350
exports.default = function (target) {
13511351
target.prototype.isCapture = function (currentTarget) {
1352-
if (!currentTarget) return false;
1353-
var dataIsCapture = currentTarget.getAttribute('data-iscapture');
1354-
return dataIsCapture && dataIsCapture === 'true' || this.props.isCapture || false;
1352+
return currentTarget && currentTarget.getAttribute('data-iscapture') === 'true' || this.props.isCapture || false;
13551353
};
13561354
};
13571355

0 commit comments

Comments
 (0)