Socket
Book a DemoSign in
Socket

sanitize-html

Package Overview
Dependencies
Maintainers
4
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sanitize-html - npm Package Compare versions

Comparing version
2.17.1
to
2.17.2
+7
-1
index.js

@@ -569,2 +569,7 @@ const htmlparser = require('htmlparser2');

result += text;
} else if ((options.disallowedTagsMode === 'discard' || options.disallowedTagsMode === 'completelyDiscard') && (nonTextTagsArray.indexOf(tag) !== -1)) {
// htmlparser2 does not decode entities inside raw text elements like
// textarea and option. The text is already properly encoded, so pass
// it through without additional escaping to avoid double-encoding.
result += text;
} else if (!addedText) {

@@ -675,3 +680,4 @@ const escaped = escapeHtml(text, false);

const lastParsedIndex = parser.endIndex;
if (lastParsedIndex != null && lastParsedIndex >= 0 && lastParsedIndex < html.length) {
if (lastParsedIndex != null && lastParsedIndex >= 0 &&
lastParsedIndex < html.length) {
const unparsed = html.substring(lastParsedIndex);

@@ -678,0 +684,0 @@ result += escapeHtml(unparsed);

+2
-2
{
"name": "sanitize-html",
"version": "2.17.1",
"version": "2.17.2",
"description": "Clean up user-submitted HTML, preserving allowlisted elements and allowlisted attributes on a per-element basis",

@@ -27,3 +27,3 @@ "sideEffects": false,

"escape-string-regexp": "^4.0.0",
"htmlparser2": "^8.0.0",
"htmlparser2": "^10.1.0",
"is-plain-object": "^5.0.0",

@@ -30,0 +30,0 @@ "parse-srcset": "^1.0.2",