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.0 to 0.5.1

4

lib/helpers.js

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

Helpers.prototype.isJS = function isJS (element) {
return element.type === 'script'
&& !/script.*?type\s*=\s*.(?!text\/javascript).*/i.test(element.data);
return (element.type === 'script' && !element.attribs)
|| (element.type === 'script' && element.attribs.type === 'text/javascript');
};

@@ -144,0 +144,0 @@

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

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

@@ -10,2 +10,3 @@ {

, "cdata": "<script type=\"text/javascript\">\n//<![CDATA[\n...code...\n//]]>\n</script>"
, "noscript": "<script type=\"imno/script\" id=plates-forgot><h3>\n Forgot your password?\n <a href=\"#\" class=\"close ss-delete\"></a>\n </h3>\n\n <p>Tell us your username and we will reset it for you.</p>\n\n <p class=\"error alert\"></p>\n <p class=\"success alert\"></p></script>"
, "doctype": {

@@ -55,2 +56,3 @@ "data": "!doctype html"

, "name": "script"
, "attribs": { "type": "text/javascript" }
, "children": null

@@ -57,0 +59,0 @@ , "prev": null

@@ -188,3 +188,3 @@ /*global beforeEach, afterEach*/

expect(helpers.script(html.script, '')).to.be.equal(
'<script>'
'<script type=text/javascript>'
);

@@ -276,3 +276,4 @@

afterEach(function () {
html.script.data = 'script type="text/javascript"';
html.script.name = 'script';
html.script.attribs = { type: 'text/javascript' }
});

@@ -285,4 +286,2 @@

it('returns true if type is script and attribute === null', function () {
html.script.data = 'script';
expect(helpers.isJS(html.script)).to.be.true;

@@ -296,3 +295,3 @@ });

it('returns false if type !== "text/javascript"', function () {
html.script.data = 'script type="text/template"';
html.script.attribs.type = 'text/template';
expect(helpers.isJS(html.script)).to.be.false;

@@ -299,0 +298,0 @@ });

@@ -92,2 +92,9 @@ 'use strict';

it('should minify script content that is not real text/javascript as much as possible', function (done) {
minimize.parse(html.noscript, function (error, result) {
expect(result).to.equal('<script type=imno/script id=plates-forgot><h3> Forgot your password? <a href="#" class="close ss-delete"></a> </h3> <p>Tell us your username and we will reset it for you.</p> <p class="error alert"></p> <p class="success alert"></p></script>');
done();
});
});
it('should replace newlines between text with spaces', function (done) {

@@ -94,0 +101,0 @@ minimize.parse(html.newlines, function (error, result) {

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