Socket
Socket
Sign inDemoInstall

minimize

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minimize - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## v0.5.2
- [Fix] Make sure script without type=test/javascript is not minified
## v0.5.1
- [Fix] Improve tests against scripts
## v0.5.0

@@ -2,0 +8,0 @@ - [Major] Upgrade to htmlparser2 module for faster parsing and more options.

2

lib/helpers.js

@@ -140,3 +140,3 @@ 'use strict';

Helpers.prototype.isJS = function isJS (element) {
return (element.type === 'script' && !element.attribs)
return (element.type === 'script' && (!element.attribs || !element.attribs.type))
|| (element.type === 'script' && element.attribs.type === 'text/javascript');

@@ -143,0 +143,0 @@ };

{
"name": "minimize",
"version": "0.5.1",
"version": "0.5.2",
"description": "Minimize HTML",

@@ -5,0 +5,0 @@ "main": "./lib/minimize",

@@ -283,6 +283,12 @@ /*global beforeEach, afterEach*/

it('returns true if type is script and attribute === null', function () {
it('returns true if type is script and has no attributes', function () {
html.script.attribs = {};
expect(helpers.isJS(html.script)).to.be.true;
});
it('returns true if type is script and has random attributes', function () {
html.script.attribs = { 'data-type': 'test' };
expect(helpers.isJS(html.script)).to.be.true;
});
it('returns true if type is script and attribute === "text/javascript"', function () {

@@ -289,0 +295,0 @@ expect(helpers.isJS(html.script)).to.be.true;

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