Socket
Socket
Sign inDemoInstall

clean-html

Package Overview
Dependencies
12
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.2 to 1.4.3

23

index.js
var htmlparser = require('htmlparser2'),
unsupportedTags = [
'script',
'style'
],
voidElements = [

@@ -80,6 +84,2 @@ 'area',

'replace-nbsp': false,
'unsupported-tags': [
'script',
'style'
],
'wrap': 120

@@ -163,2 +163,6 @@ };

function removeExtraSpace(text) {
return text.replace(/\s+/g, ' ');
}
function shouldRemove(node) {

@@ -185,3 +189,3 @@ if (node.type == 'text') {

var text = node.data;
var text = removeExtraSpace(node.data);

@@ -200,4 +204,3 @@ if (options['replace-nbsp']) {

// replace all whitespace characters with a single space
return text.replace(/\s+/g, ' ');
return text;
}

@@ -210,3 +213,3 @@

var comment = '<!--' + node.data.replace(/\s+/g, ' ') + '-->';
var comment = '<!--' + removeExtraSpace(node.data) + '-->';

@@ -221,3 +224,3 @@ if (breakAround(node)) {

function renderTag(node) {
if (options['unsupported-tags'].indexOf(node.name) != -1) {
if (unsupportedTags.indexOf(node.name) != -1) {
return '';

@@ -238,3 +241,3 @@ }

if (options['remove-attributes'].indexOf(attrib) == -1) {
openTag += ' ' + attrib + '="' + node.attribs[attrib] + '"';
openTag += ' ' + attrib + '="' + removeExtraSpace(node.attribs[attrib]) + '"';
}

@@ -241,0 +244,0 @@ }

{
"name": "clean-html",
"version": "1.4.2",
"version": "1.4.3",
"description": "HTML cleaner and beautifier",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -0,1 +1,14 @@

1.4.3
-----
Extra spaces are now removed from attribute values.
1.4.2
-----
Hanging indent is now applied to wrapped lines.
Multiline comments are now squashed into a single line, just like text. This
makes wrapping them easier and simplifies how conditional comments are handled.
1.4.1

@@ -2,0 +15,0 @@ -----

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc