sanitize-html
Advanced tools
Comparing version 2.6.0 to 2.6.1
# 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 @@ |
@@ -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, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75486
748