Skip to content

Commit b761550

Browse files
authored
Check highlight tags before replacing them (#82)
1 parent 8e9be65 commit b761550

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/format.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ function replaceHighlightTags(value, highlightPreTag, highlightPostTag) {
55
// If the value of the attribute is a string,
66
// the highlight is applied by MeiliSearch (<em> tags)
77
// and we replace the <em> by the expected tag for InstantSearch
8-
if (isString(value)) {
8+
if (
9+
isString(value) &&
10+
highlightPreTag !== undefined &&
11+
highlightPostTag !== undefined
12+
) {
913
newHighlightValue = value
1014
.replace(/<em>/g, highlightPreTag)
1115
.replace(/<\/em>/g, highlightPostTag)

0 commit comments

Comments
 (0)