Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sanitize-html

Package Overview
Dependencies
Maintainers
13
Versions
114
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.6.0 to 2.6.1

5

CHANGELOG.md
# Changelog
## 2.6.1 (2021-12-08)
- Fixes style filtering to retain `!important` when used.
- Fixed trailing text bug on `transformTags` options that was reported on [issue #506](https://github.com/apostrophecms/sanitize-html/issues/506). Thanks to [Alex Rantos](https://github.com/alex-rantos).
## 2.6.0 (2021-11-23)

@@ -4,0 +9,0 @@

9

index.js

@@ -585,2 +585,3 @@ const htmlparser = require('htmlparser2');

}
addedText = false;
}

@@ -694,13 +695,13 @@ }, options.parser);

/**
* Extracts the style attribues from an AbstractSyntaxTree and formats those
* Extracts the style attributes from an AbstractSyntaxTree and formats those
* values in the inline style attribute format.
*
* @param {AbstractSyntaxTree} filteredAST
* @return {string} - Example: "color:yellow;text-align:center;font-family:helvetica;"
* @return {string} - Example: "color:yellow;text-align:center !important;font-family:helvetica;"
*/
function stringifyStyleAttributes(filteredAST) {
return filteredAST.nodes[0].nodes
.reduce(function(extractedAttributes, attributeObject) {
.reduce(function(extractedAttributes, attrObject) {
extractedAttributes.push(
attributeObject.prop + ':' + attributeObject.value
`${attrObject.prop}:${attrObject.value}${attrObject.important ? ' !important' : ''}`
);

@@ -707,0 +708,0 @@ return extractedAttributes;

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

@@ -5,0 +5,0 @@ "sideEffects": false,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc