Skip to content

Commit

Permalink
escape backslash and double quote in getTargetArray method
Browse files Browse the repository at this point in the history
  • Loading branch information
rnons committed Mar 19, 2017
1 parent 8a20794 commit 2621f5e
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 2621f5e

Please sign in to comment.