Skip to content

Commit

Permalink
feat(dropdown,search): respect preserveHTML
Browse files Browse the repository at this point in the history
  • Loading branch information
lubber-de committed Dec 15, 2023
1 parent 65c2d5d commit 3583eb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,9 @@
var $result = $(result),
markedHTML = module.get.choiceText($result)
;
if (!settings.preserveHTML) {
markedHTML = module.escape.htmlEntities(markedHTML);
}
if (settings.ignoreDiacritics) {
markedHTML = markedHTML.normalize('NFD');
}
Expand Down Expand Up @@ -3833,8 +3836,7 @@
;
if (shouldEscape.test(string)) {
string = string.replace(forceAmpersand ? /&/g : /&(?![\d#a-z]{1,12};)/gi, '&');

return string.replace(badChars, escapedChar);
string = string.replace(badChars, escapedChar);
}

return string;
Expand Down Expand Up @@ -4262,8 +4264,7 @@
;
if (shouldEscape.test(string)) {
string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&');

return string.replace(badChars, escapedChar);
string = string.replace(badChars, escapedChar);
}

return string;
Expand Down
5 changes: 3 additions & 2 deletions src/definitions/modules/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -1479,8 +1479,9 @@
};
if (shouldEscape.test(string)) {
string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&');

return string.replace(badChars, escapedChar);
string = string.replace(badChars, escapedChar);
// FUI controlled HTML is still allowed
string = string.replace(/&lt;(\/)*mark&gt;/g, '<$1mark>');
}

return string;
Expand Down

0 comments on commit 3583eb0

Please sign in to comment.