Skip to content

Commit db21f21

Browse files
committed
Fetch data attributes safer
1 parent aa8295e commit db21f21

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/decorators/bodyMode.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ const bodyListener = function (callback, options, e) {
1919
const {respectEffect = false, customEvent = false} = options
2020
const {id} = this.props
2121

22-
const tip = e.target.dataset.tip
23-
const _for = e.target.dataset.for
22+
const tip = e.target.getAttribute('data-tip') || null
23+
const forId = e.target.getAttribute('data-for') || null
2424

2525
const target = e.target
2626
if (this.isCustomEvent(target) && !customEvent) {
2727
return
2828
}
2929

3030
const isTargetBelongsToTooltip =
31-
(id == null && _for == null) || (id != null && _for === id)
31+
(id == null && forId == null) || forId === id
3232

3333
if (tip != null &&
3434
(!respectEffect || this.getEffect(target) === 'float') &&

0 commit comments

Comments
 (0)