Skip to content

Commit

Permalink
still add text added by transformation when tag is discarded
Browse files Browse the repository at this point in the history
  • Loading branch information
f0x52 committed Dec 6, 2024
1 parent 20878b9 commit 98b4900
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,15 @@ function sanitizeHtml(html, options, _recursing) {
if (skip) {
if (options.disallowedTagsMode === 'discard' || options.disallowedTagsMode === 'completelyDiscard') {
// We want the contents but not this tag
if (frame.innerText && !hasText) {
const escaped = escapeHtml(frame.innerText);
if (options.textFilter) {
result += options.textFilter(escaped, name);
} else {
result += escapeHtml(frame.innerText);
}
addedText = true;
}
return;
}
tempResult = result;
Expand Down

0 comments on commit 98b4900

Please sign in to comment.