sanitize-html 2.13.1 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +9 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -274,6 +274,15 @@ function sanitizeHtml(html, options, _recursing) {
274
274
  if (skip) {
275
275
  if (options.disallowedTagsMode === 'discard' || options.disallowedTagsMode === 'completelyDiscard') {
276
276
  // We want the contents but not this tag
277
+ if (frame.innerText && !hasText) {
278
+ const escaped = escapeHtml(frame.innerText);
279
+ if (options.textFilter) {
280
+ result += options.textFilter(escaped, name);
281
+ } else {
282
+ result += escapeHtml(frame.innerText);
283
+ }
284
+ addedText = true;
285
+ }
277
286
  return;
278
287
  }
279
288
  tempResult = result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanitize-html",
3
- "version": "2.13.1",
3
+ "version": "2.14.0",
4
4
  "description": "Clean up user-submitted HTML, preserving allowlisted elements and allowlisted attributes on a per-element basis",
5
5
  "sideEffects": false,
6
6
  "main": "index.js",