Skip to content

Commit

Permalink
fix(tooltip): fix matchRegexp for startwith pattern (#1340)
Browse files Browse the repository at this point in the history
  • Loading branch information
lionelB authored Sep 27, 2019
1 parent 0bd93ce commit 9588ae0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/code-du-travail-frontend/src/common/Answer.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function Answer({

patterns.forEach(pattern => {
node.innerHTML = node.innerHTML.replace(pattern, function(match) {
if (new RegExp("^[^\\w${frDiacritics}]").test(match)) {
if (new RegExp(`^[^\\w${frDiacritics}]`).test(match)) {
// Since match string can start with a space, we trim it and insert the space before the tooltip markup
return `${match.slice(0, 1)}<span data-tooltip-slug="${
item.slug
Expand Down

0 comments on commit 9588ae0

Please sign in to comment.