Skip to content

Commit

Permalink
Merge pull request #236 from rnons/patch-1
Browse files Browse the repository at this point in the history
escape backslash in getTargetArray method
  • Loading branch information
wwayne authored Mar 20, 2017
2 parents 8a20794 + 2621f5e commit a030f50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ class ReactTooltip extends Component {
if (!id) {
targetArray = document.querySelectorAll('[data-tip]:not([data-for])')
} else {
targetArray = document.querySelectorAll(`[data-tip][data-for="${id}"]`)
const escaped = id.replace(/\\/g, '\\\\').replace(/"/g, '\\"')
targetArray = document.querySelectorAll(`[data-tip][data-for="${escaped}"]`)
}
// targetArray is a NodeList, convert it to a real array
return nodeListToArray(targetArray)
Expand Down

0 comments on commit a030f50

Please sign in to comment.