From: alexlamsl
Date: Mon, 4 Apr 2016 10:47:47 +0000 (+0800)
Subject: no spaces within array brackets
X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=5e6b3ca0c64e7ad75c538322bf2cb948b01d6609;p=html-minifier.git
no spaces within array brackets
---
diff --git a/.eslintrc.json b/.eslintrc.json
index 02018a3..cc51726 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -4,10 +4,7 @@
},
"extends": "eslint:recommended",
"rules": {
- "array-bracket-spacing": [
- "error",
- "always"
- ],
+ "array-bracket-spacing": "error",
"block-scoped-var": "error",
"block-spacing": "error",
"brace-style": [
diff --git a/Gruntfile.js b/Gruntfile.js
index 67bdf68..4b58ca3 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -33,16 +33,16 @@ module.exports = function(grunt) {
src: 'Gruntfile.js'
},
src: {
- src: [ 'cli.js', 'src/**/*.js' ]
+ src: ['cli.js', 'src/**/*.js']
},
tests: {
- src: [ 'tests/*.js', 'test.js' ]
+ src: ['tests/*.js', 'test.js']
},
web: {
src: 'assets/master.js'
},
other: {
- src: [ 'backtest.js', 'benchmark.js' ]
+ src: ['backtest.js', 'benchmark.js']
}
},
@@ -75,7 +75,7 @@ module.exports = function(grunt) {
});
require('load-grunt-tasks')(grunt, {
- pattern: [ 'grunt-*', '!grunt-lib-*' ],
+ pattern: ['grunt-*', '!grunt-lib-*'],
scope: 'devDependencies'
});
require('time-grunt')(grunt);
diff --git a/backtest.js b/backtest.js
index 8c4304b..337f4fd 100644
--- a/backtest.js
+++ b/backtest.js
@@ -14,7 +14,7 @@ var fileNames = Object.keys(urls);
function git() {
var args = [].concat.apply([], [].slice.call(arguments, 0, -1));
var callback = arguments[arguments.length - 1];
- var task = child_process.spawn('git', args, { stdio: [ 'ignore', 'pipe', 'ignore' ] });
+ var task = child_process.spawn('git', args, { stdio: ['ignore', 'pipe', 'ignore'] });
var output = '';
task.stdout.setEncoding('utf8');
task.stdout.on('data', function(data) {
@@ -94,7 +94,7 @@ function print(table) {
output.push(row.join(','));
for (var hash in table) {
var data = table[hash];
- row = [ hash, '"' + data.date + '"' ];
+ row = [hash, '"' + data.date + '"'];
fileNames.forEach(function(fileName) {
row.push(data[fileName]);
});
@@ -178,7 +178,7 @@ if (process.argv.length > 2) {
}
else {
process.on('message', function(hash) {
- var paths = [ 'src', 'benchmark.conf', 'sample-cli-config-file.conf' ];
+ var paths = ['src', 'benchmark.conf', 'sample-cli-config-file.conf'];
git('reset', 'HEAD', '--', paths, function() {
var conf = 'sample-cli-config-file.conf';
diff --git a/benchmark.js b/benchmark.js
index 550da02..57a5240 100644
--- a/benchmark.js
+++ b/benchmark.js
@@ -27,8 +27,8 @@ var progress = new Progress('[:bar] :etas :fileName', {
});
var table = new Table({
- head: [ 'File', 'Before', 'After', 'Minimize', 'Will Peavy', 'htmlcompressor.com', 'Savings', 'Time' ],
- colWidths: [ 20, 25, 25, 25, 25, 25, 20, 10 ]
+ head: ['File', 'Before', 'After', 'Minimize', 'Will Peavy', 'htmlcompressor.com', 'Savings', 'Time'],
+ colWidths: [20, 25, 25, 25, 25, 25, 20, 10]
});
function toKb(size) {
@@ -131,7 +131,7 @@ run(fileNames.map(function (fileName) {
brFilePath: path.join('benchmarks/generated/', fileName + '.html.br')
};
var infos = {};
- [ 'minifier', 'minimize', 'willpeavy', 'compressor' ].forEach(function (name) {
+ ['minifier', 'minimize', 'willpeavy', 'compressor'].forEach(function (name) {
infos[name] = {
filePath: path.join('benchmarks/generated/', fileName + '.' + name + '.html'),
gzFilePath: path.join('benchmarks/generated/', fileName + '.' + name + '.html.gz'),
@@ -199,7 +199,7 @@ run(fileNames.map(function (fileName) {
function testHTMLMinifier(done) {
var info = infos.minifier;
info.startTime = Date.now();
- var args = [ filePath, '-c', 'sample-cli-config-file.conf', '--minify-urls', urls[fileName], '-o', info.filePath ];
+ var args = [filePath, '-c', 'sample-cli-config-file.conf', '--minify-urls', urls[fileName], '-o', info.filePath];
fork('./cli', args).on('exit', function () {
readSizes(info, done);
});
@@ -303,12 +303,12 @@ run(fileNames.map(function (fileName) {
testHTMLCompressor
], function () {
var row = [
- [ fileName, '+ gzip', '+ lzma', '+ brotli' ].join('\n'),
- [ redSize(original.size), redSize(original.gzSize), redSize(original.lzSize), redSize(original.brSize) ].join('\n')
+ [fileName, '+ gzip', '+ lzma', '+ brotli'].join('\n'),
+ [redSize(original.size), redSize(original.gzSize), redSize(original.lzSize), redSize(original.brSize)].join('\n')
];
for (var name in infos) {
var info = infos[name];
- row.push([ greenSize(info.size), greenSize(info.gzSize), greenSize(info.lzSize), greenSize(info.brSize) ].join('\n'));
+ row.push([greenSize(info.size), greenSize(info.gzSize), greenSize(info.lzSize), greenSize(info.brSize)].join('\n'));
}
row.push(
[
diff --git a/cli.js b/cli.js
index d0a94d9..efc680b 100755
--- a/cli.js
+++ b/cli.js
@@ -54,49 +54,49 @@ usage += ' on the command line you must escape those such as --ignore-custom-
cli.setUsage(usage);
var mainOptions = {
- caseSensitive: [ [ false, 'Treat attributes in case sensitive manner (useful for SVG; e.g. viewBox)' ] ],
- collapseBooleanAttributes: [ [ false, 'Omit attribute values from boolean attributes' ] ],
- collapseInlineTagWhitespace: [ [ false, 'Collapse white space around inline tag' ] ],
- collapseWhitespace: [ [ false, 'Collapse white space that contributes to text nodes in a document tree.' ] ],
- conservativeCollapse: [ [ false, 'Always collapse to 1 space (never remove it entirely)' ] ],
- customAttrAssign: [ [ false, 'Arrays of regex\'es that allow to support custom attribute assign expressions (e.g. \'\')', 'string' ], 'json-regex' ],
- customAttrCollapse: [ [ false, 'Regex that specifies custom attribute to strip newlines from (e.g. /ng\-class/)', 'string' ], 'string-regex' ],
- customAttrSurround: [ [ false, 'Arrays of regex\'es that allow to support custom attribute surround expressions (e.g. )', 'string' ], 'json-regex' ],
- customEventAttributes: [ [ false, 'Arrays of regex\'es that allow to support custom event attributes for minifyJS (e.g. ng-click)', 'string' ], 'json-regex' ],
- html5: [ [ false, 'Parse input according to HTML5 specifications' ] ],
- ignoreCustomComments: [ [ false, 'Array of regex\'es that allow to ignore certain comments, when matched', 'string' ], 'json-regex' ],
- ignoreCustomFragments: [ [ false, 'Array of regex\'es that allow to ignore certain fragments, when matched (e.g. , {{ ... }})', 'string' ], 'json-regex' ],
- includeAutoGeneratedTags: [ [ false, 'Insert tags generated by HTML parser' ], true ],
- keepClosingSlash: [ [ false, 'Keep the trailing slash on singleton elements' ] ],
- lint: [ [ false, 'Toggle linting' ] ],
- maxLineLength: [ [ false, 'Max line length', 'number' ], true ],
- minifyCSS: [ [ false, 'Minify CSS in style elements and style attributes (uses clean-css)' ] ],
- minifyJS: [ [ false, 'Minify Javascript in script elements and on* attributes (uses UglifyJS)' ] ],
- minifyURLs: [ [ false, 'Minify URLs in various attributes (uses relateurl)', 'string' ], 'site-url' ],
- preserveLineBreaks: [ [ false, 'Always collapse to 1 line break (never remove it entirely) when whitespace between tags include a line break.' ] ],
- preventAttributesEscaping: [ [ false, 'Prevents the escaping of the values of attributes.' ] ],
- processConditionalComments: [ [ false, 'Process contents of conditional comments through minifier' ] ],
- processScripts: [ [ false, 'Array of strings corresponding to types of script elements to process through minifier (e.g. "text/ng-template", "text/x-handlebars-template", etc.)', 'string' ], 'json' ],
- quoteCharacter: [ [ false, 'Type of quote to use for attribute values (\' or ")', 'string' ], true ],
- removeAttributeQuotes: [ [ false, 'Remove quotes around attributes when possible.' ] ],
- removeComments: [ [ false, 'Strip HTML comments' ] ],
- removeEmptyAttributes: [ [ false, 'Remove all attributes with whitespace-only values' ] ],
- removeEmptyElements: [ [ false, 'Remove all elements with empty contents' ] ],
- removeOptionalTags: [ [ false, 'Remove unrequired tags' ] ],
- removeRedundantAttributes: [ [ false, 'Remove attributes when value matches default.' ] ],
- removeScriptTypeAttributes: [ [ false, 'Remove type="text/javascript" from script tags. Other type attribute values are left intact.' ] ],
- removeStyleLinkTypeAttributes: [ [ false, 'Remove type="text/css" from style and link tags. Other type attribute values are left intact.' ] ],
- removeTagWhitespace: [ [ false, 'Remove space between attributes whenever possible' ] ],
- sortAttributes: [ [ false, 'Sort attributes by frequency' ] ],
- useShortDoctype: [ [ false, 'Replaces the doctype with the short (HTML5) doctype' ] ]
+ caseSensitive: [[false, 'Treat attributes in case sensitive manner (useful for SVG; e.g. viewBox)']],
+ collapseBooleanAttributes: [[false, 'Omit attribute values from boolean attributes']],
+ collapseInlineTagWhitespace: [[false, 'Collapse white space around inline tag']],
+ collapseWhitespace: [[false, 'Collapse white space that contributes to text nodes in a document tree.']],
+ conservativeCollapse: [[false, 'Always collapse to 1 space (never remove it entirely)']],
+ customAttrAssign: [[false, 'Arrays of regex\'es that allow to support custom attribute assign expressions (e.g. \'\')', 'string'], 'json-regex'],
+ customAttrCollapse: [[false, 'Regex that specifies custom attribute to strip newlines from (e.g. /ng\-class/)', 'string'], 'string-regex'],
+ customAttrSurround: [[false, 'Arrays of regex\'es that allow to support custom attribute surround expressions (e.g. )', 'string'], 'json-regex'],
+ customEventAttributes: [[false, 'Arrays of regex\'es that allow to support custom event attributes for minifyJS (e.g. ng-click)', 'string'], 'json-regex'],
+ html5: [[false, 'Parse input according to HTML5 specifications']],
+ ignoreCustomComments: [[false, 'Array of regex\'es that allow to ignore certain comments, when matched', 'string'], 'json-regex'],
+ ignoreCustomFragments: [[false, 'Array of regex\'es that allow to ignore certain fragments, when matched (e.g. , {{ ... }})', 'string'], 'json-regex'],
+ includeAutoGeneratedTags: [[false, 'Insert tags generated by HTML parser'], true],
+ keepClosingSlash: [[false, 'Keep the trailing slash on singleton elements']],
+ lint: [[false, 'Toggle linting']],
+ maxLineLength: [[false, 'Max line length', 'number'], true],
+ minifyCSS: [[false, 'Minify CSS in style elements and style attributes (uses clean-css)']],
+ minifyJS: [[false, 'Minify Javascript in script elements and on* attributes (uses UglifyJS)']],
+ minifyURLs: [[false, 'Minify URLs in various attributes (uses relateurl)', 'string'], 'site-url'],
+ preserveLineBreaks: [[false, 'Always collapse to 1 line break (never remove it entirely) when whitespace between tags include a line break.']],
+ preventAttributesEscaping: [[false, 'Prevents the escaping of the values of attributes.']],
+ processConditionalComments: [[false, 'Process contents of conditional comments through minifier']],
+ processScripts: [[false, 'Array of strings corresponding to types of script elements to process through minifier (e.g. "text/ng-template", "text/x-handlebars-template", etc.)', 'string'], 'json'],
+ quoteCharacter: [[false, 'Type of quote to use for attribute values (\' or ")', 'string'], true],
+ removeAttributeQuotes: [[false, 'Remove quotes around attributes when possible.']],
+ removeComments: [[false, 'Strip HTML comments']],
+ removeEmptyAttributes: [[false, 'Remove all attributes with whitespace-only values']],
+ removeEmptyElements: [[false, 'Remove all elements with empty contents']],
+ removeOptionalTags: [[false, 'Remove unrequired tags']],
+ removeRedundantAttributes: [[false, 'Remove attributes when value matches default.']],
+ removeScriptTypeAttributes: [[false, 'Remove type="text/javascript" from script tags. Other type attribute values are left intact.']],
+ removeStyleLinkTypeAttributes: [[false, 'Remove type="text/css" from style and link tags. Other type attribute values are left intact.']],
+ removeTagWhitespace: [[false, 'Remove space between attributes whenever possible']],
+ sortAttributes: [[false, 'Sort attributes by frequency']],
+ useShortDoctype: [[false, 'Replaces the doctype with the short (HTML5) doctype']]
};
var cliOptions = {
- version: [ 'v', 'Version information' ],
- output: [ 'o', 'Specify output file (if not specified STDOUT will be used for output)', 'file' ],
- 'config-file': [ 'c', 'Use config file', 'file' ],
- 'input-dir': [ false, 'Specify an input directory', 'dir' ],
- 'output-dir': [ false, 'Specify an output directory', 'dir' ]
+ version: ['v', 'Version information'],
+ output: ['o', 'Specify output file (if not specified STDOUT will be used for output)', 'file'],
+ 'config-file': ['c', 'Use config file', 'file'],
+ 'input-dir': [false, 'Specify an input directory', 'dir'],
+ 'output-dir': [false, 'Specify an output directory', 'dir']
};
var mainOptionKeys = Object.keys(mainOptions);
@@ -147,7 +147,7 @@ cli.main(function(args, options) {
catch (e) {
cli.fatal('Could not parse JSON value \'' + value + '\'');
}
- return Array.isArray(jsonArray) ? jsonArray : [ value ];
+ return Array.isArray(jsonArray) ? jsonArray : [value];
}
}
diff --git a/dist/htmlminifier.js b/dist/htmlminifier.js
index fc9505d..7df336b 100644
--- a/dist/htmlminifier.js
+++ b/dist/htmlminifier.js
@@ -31166,7 +31166,7 @@ function isInaccessibleAttribute(attrName, attrValue) {
}
function Lint() {
- this.log = [ ];
+ this.log = [];
this._lastElement = null;
this._isElementRepeated = false;
}
@@ -31326,7 +31326,7 @@ function makeMap(values) {
// Regular Expressions for parsing tags and attributes
var singleAttrIdentifier = /([^\s"'<>\/=]+)/,
singleAttrAssign = /=/,
- singleAttrAssigns = [ singleAttrAssign ],
+ singleAttrAssigns = [singleAttrAssign],
singleAttrValues = [
// attr value double quotes
/"([^"]*)"+/.source,
@@ -32399,7 +32399,7 @@ function processOptions(options) {
options.includeAutoGeneratedTags = true;
}
- var defaultTesters = [ 'canCollapseWhitespace', 'canTrimWhitespace' ];
+ var defaultTesters = ['canCollapseWhitespace', 'canTrimWhitespace'];
for (var i = 0, len = defaultTesters.length; i < len; i++) {
if (!options[defaultTesters[i]]) {
options[defaultTesters[i]] = function() {
@@ -32529,7 +32529,7 @@ function minify(value, options, partialMarkup) {
processOptions(options);
value = options.collapseWhitespace ? trimWhitespace(value) : value;
- var buffer = [ ],
+ var buffer = [],
charsPrevTag,
currentChars = '',
hasChars,
@@ -32541,8 +32541,8 @@ function minify(value, options, partialMarkup) {
optionalEndTag = '',
lint = options.lint,
t = Date.now(),
- ignoredMarkupChunks = [ ],
- ignoredCustomMarkupChunks = [ ],
+ ignoredMarkupChunks = [],
+ ignoredCustomMarkupChunks = [],
uidIgnore,
uidAttr;
@@ -32702,7 +32702,7 @@ function minify(value, options, partialMarkup) {
options.sortAttributes(tag, attrs);
}
- var parts = [ ];
+ var parts = [];
var token, isLast = true;
for (var i = attrs.length; --i >= 0;) {
if (lint) {
diff --git a/src/htmllint.js b/src/htmllint.js
index e4d22de..0c4a69d 100644
--- a/src/htmllint.js
+++ b/src/htmllint.js
@@ -61,7 +61,7 @@ function isInaccessibleAttribute(attrName, attrValue) {
}
function Lint() {
- this.log = [ ];
+ this.log = [];
this._lastElement = null;
this._isElementRepeated = false;
}
diff --git a/src/htmlminifier.js b/src/htmlminifier.js
index 75aaae2..e722b45 100644
--- a/src/htmlminifier.js
+++ b/src/htmlminifier.js
@@ -583,7 +583,7 @@ function processOptions(options) {
options.includeAutoGeneratedTags = true;
}
- var defaultTesters = [ 'canCollapseWhitespace', 'canTrimWhitespace' ];
+ var defaultTesters = ['canCollapseWhitespace', 'canTrimWhitespace'];
for (var i = 0, len = defaultTesters.length; i < len; i++) {
if (!options[defaultTesters[i]]) {
options[defaultTesters[i]] = function() {
@@ -713,7 +713,7 @@ function minify(value, options, partialMarkup) {
processOptions(options);
value = options.collapseWhitespace ? trimWhitespace(value) : value;
- var buffer = [ ],
+ var buffer = [],
charsPrevTag,
currentChars = '',
hasChars,
@@ -725,8 +725,8 @@ function minify(value, options, partialMarkup) {
optionalEndTag = '',
lint = options.lint,
t = Date.now(),
- ignoredMarkupChunks = [ ],
- ignoredCustomMarkupChunks = [ ],
+ ignoredMarkupChunks = [],
+ ignoredCustomMarkupChunks = [],
uidIgnore,
uidAttr;
@@ -886,7 +886,7 @@ function minify(value, options, partialMarkup) {
options.sortAttributes(tag, attrs);
}
- var parts = [ ];
+ var parts = [];
var token, isLast = true;
for (var i = attrs.length; --i >= 0;) {
if (lint) {
diff --git a/src/htmlparser.js b/src/htmlparser.js
index cad1606..68cdea9 100644
--- a/src/htmlparser.js
+++ b/src/htmlparser.js
@@ -39,7 +39,7 @@ function makeMap(values) {
// Regular Expressions for parsing tags and attributes
var singleAttrIdentifier = /([^\s"'<>\/=]+)/,
singleAttrAssign = /=/,
- singleAttrAssigns = [ singleAttrAssign ],
+ singleAttrAssigns = [singleAttrAssign],
singleAttrValues = [
// attr value double quotes
/"([^"]*)"+/.source,
diff --git a/test.js b/test.js
index 7d8c0da..e7d5e52 100644
--- a/test.js
+++ b/test.js
@@ -7,7 +7,7 @@ testrunner.options.log.tests = false;
testrunner.options.log.assertions = false;
testrunner.run({
- deps: [ './src/htmlparser.js', './src/htmllint.js' ],
+ deps: ['./src/htmlparser.js', './src/htmllint.js'],
code: './src/htmlminifier.js',
tests: [
'./tests/lint.js',
diff --git a/tests/inject.js b/tests/inject.js
index 902a4e3..54fd80b 100644
--- a/tests/inject.js
+++ b/tests/inject.js
@@ -1,5 +1,5 @@
'use strict';
QUnit.done(function(details) {
- alert(JSON.stringify([ 'qunit.done', details ]));
+ alert(JSON.stringify(['qunit.done', details]));
});
diff --git a/tests/minifier.js b/tests/minifier.js
index 0fe41d3..dde08c9 100644
--- a/tests/minifier.js
+++ b/tests/minifier.js
@@ -851,7 +851,7 @@ test('preserving custom attribute-wrapping markup', function() {
// With a single rule
customAttrOptions = {
- customAttrSurround: [ [ /\{\{#if\s+\w+\}\}/, /\{\{\/if\}\}/ ] ]
+ customAttrSurround: [[/\{\{#if\s+\w+\}\}/, /\{\{\/if\}\}/]]
};
input = '';
@@ -863,8 +863,8 @@ test('preserving custom attribute-wrapping markup', function() {
// With multiple rules
customAttrOptions = {
customAttrSurround: [
- [ /\{\{#if\s+\w+\}\}/, /\{\{\/if\}\}/ ],
- [ /\{\{#unless\s+\w+\}\}/, /\{\{\/unless\}\}/ ]
+ [/\{\{#if\s+\w+\}\}/, /\{\{\/if\}\}/],
+ [/\{\{#unless\s+\w+\}\}/, /\{\{\/unless\}\}/]
]
};
@@ -883,8 +883,8 @@ test('preserving custom attribute-wrapping markup', function() {
// With multiple rules and richer options
customAttrOptions = {
customAttrSurround: [
- [ /\{\{#if\s+\w+\}\}/, /\{\{\/if\}\}/ ],
- [ /\{\{#unless\s+\w+\}\}/, /\{\{\/unless\}\}/ ]
+ [/\{\{#if\s+\w+\}\}/, /\{\{\/if\}\}/],
+ [/\{\{#unless\s+\w+\}\}/, /\{\{\/unless\}\}/]
],
collapseBooleanAttributes: true,
removeAttributeQuotes: true
@@ -903,7 +903,7 @@ test('preserving custom attribute-wrapping markup', function() {
test('preserving custom attribute-joining markup', function() {
var polymerConditionalAttributeJoin = /\?=/;
var customAttrOptions = {
- customAttrAssign: [ polymerConditionalAttributeJoin ]
+ customAttrAssign: [polymerConditionalAttributeJoin]
};
input = '';
@@ -1373,7 +1373,7 @@ test('phrasing content with Web Components', function() {
// https://github.com/kangax/html-minifier/issues/10
test('Ignore custom fragments', function() {
- var reFragments = [ /<\?[^\?]+\?>/, /<%[^%]+%>/, /\{\{[^\}]*\}\}/ ];
+ var reFragments = [/<\?[^\?]+\?>/, /<%[^%]+%>/, /\{\{[^\}]*\}\}/];
input = 'This is the start. <% ... %>\r\n<%= ... %>\r\n ... ?>\r\n\r\nNo comment, but middle.\r\n{{ ... }}\r\n\r\n\r\nHello, this is the end!';
output = 'This is the start. <% ... %> <%= ... %> ... ?> No comment, but middle. {{ ... }} Hello, this is the end!';
@@ -1429,7 +1429,7 @@ test('Ignore custom fragments', function() {
input = '';
output = '';
- equal(minify(input, { ignoreCustomFragments: [ /\{\%[^\%]*?\%\}/g ] }), output);
+ equal(minify(input, { ignoreCustomFragments: [/\{\%[^\%]*?\%\}/g] }), output);
input = '' +
'{{ form.name.label_tag }}' +
@@ -1716,15 +1716,15 @@ test('event minification', function() {
output = '';
equal(minify(input, { minifyJS: true }), output);
- equal(minify(input, { minifyJS: true, customEventAttributes: [ ] }), input);
+ equal(minify(input, { minifyJS: true, customEventAttributes: [] }), input);
output = '';
- equal(minify(input, { minifyJS: true, customEventAttributes: [ /^ng-/ ] }), output);
+ equal(minify(input, { minifyJS: true, customEventAttributes: [/^ng-/] }), output);
output = '';
- equal(minify(input, { minifyJS: true, customEventAttributes: [ /^on/, /^ng-/ ] }), output);
+ equal(minify(input, { minifyJS: true, customEventAttributes: [/^on/, /^ng-/] }), output);
});
test('escaping closing script tag', function() {
@@ -1929,7 +1929,7 @@ test('processScripts', function() {
equal(minify(input, {
collapseWhitespace: true,
removeComments: true,
- processScripts: [ 'text/ng-template' ]
+ processScripts: ['text/ng-template']
}), output);
});
@@ -1967,7 +1967,7 @@ test('ignore', function() {
input = '
>';
output = '>';
- equal(minify(input, { ignoreCustomFragments: [ /<\?php[\s\S]*?\?>/ ] }), output);
+ equal(minify(input, { ignoreCustomFragments: [/<\?php[\s\S]*?\?>/] }), output);
input = 'a\nb';
output = 'a b';
@@ -2291,33 +2291,33 @@ test('sort attributes', function() {
test('tests from PHPTAL', function() {
[
// trailing
removed by minifier, but not by PHPTAL
- [ 'foo bar baz', '
foo \t bar\n\n\n baz
' ],
- [ 'foo bar
\tfoo\t \nbar
', 'foo \t\n bar
\tfoo\t \nbar
' ],
- [ 'foo bar baz', '
foo bar baz
' ],
- [ 'foo bar baz', '
foo bar baz
' ],
- [ 'foo bar baz', '
foo bar baz
' ],
- [ 'foo bar baz', '
foo bar baz
' ],
- [ 'foo
', '
foo
' ],
+ ['foo bar baz', '
foo \t bar\n\n\n baz
'],
+ ['foo bar
\tfoo\t \nbar
', 'foo \t\n bar
\tfoo\t \nbar
'],
+ ['foo bar baz', '
foo bar baz
'],
+ ['foo bar baz', '
foo bar baz
'],
+ ['foo bar baz', '
foo bar baz
'],
+ ['foo bar baz', '
foo bar baz
'],
+ ['foo
', '
foo
'],
// PHPTAL remove whitespace after 'foo' - problematic if is used as icon font
- [ 'foo ', '
foo
' ],
- [ 'foo ', '
foo
' ],
+ ['foo ', '
foo
'],
+ ['foo ', '
foo
'],
// comments removed by minifier, but not by PHPTAL
- [ 'foo', '
foo
' ],
- [ '', '' ],
+ ['foo', '
foo
'],
+ ['', ''],
// unary slashes removed by minifier, but not by PHPTAL
- [ '', '' ],
- [ 'x
', ' x
' ],
- [ 'x
y
', ' x
y
' ],
- [ ' y
', ' y
' ],
- [ '', '
' ],
- [ 'x
', ' x
' ],
- [ 'x y
', ' x y
' ],
- [ ' y
', ' y
' ],
- [ '', '
' ],
- [ 'x
', ' x
' ],
- [ 'x y
', ' x y
' ],
- [ ' y
', ' y
' ],
- [ '', '' ],
+ ['', ''],
+ ['x
', ' x
'],
+ ['x
y
', ' x
y
'],
+ [' y
', ' y
'],
+ ['', '
'],
+ ['x
', ' x
'],
+ ['x y
', ' x y
'],
+ [' y
', ' y
'],
+ ['', '
'],
+ ['x
', ' x
'],
+ ['x y
', ' x y
'],
+ [' y
', ' y
'],
+ ['', ''],
// optional tags removed by minifier, but not by PHPTAL
// parser cannot handle
[
@@ -2328,34 +2328,29 @@ test('tests from PHPTAL', function() {
' > \n' +
' '
],
- [ '', '' ],
- [ '', '' ],
+ ['', ''],
+ ['', ''],
/* minifier does not assume as "display: inline"
- ['', ''],
- */
- [ '', '' ],
- [ '', ' ' ],
+ ['', ''],*/
+ ['', ''],
+ ['', ' '],
/* minifier does not reorder attributes
['', ''],
- ['', ''],
- */
- [ '\n\n\ntest
', '\n\n\ntest
' ],
+ ['', ''],*/
+ ['\n\n\ntest
', '\n\n\ntest
'],
/* single line-break preceding is redundant, assuming is block element
- ['test
', '\ntest
'],
- */
+ ['test
', '\ntest
'],*/
// optional attribute quotes removed by minifier, but not by PHPTAL
- [ '', '' ],
+ ['', ''],
/* minifier does not optimise in HTML5 mode
- ['', ''],
- */
+ ['', ''],*/
/* minifier does not optimise in HTML5 mode
[
'',
''
- ],
- */
- [ '', '' ]
+ ],*/
+ ['', '']
/* trim "title" attribute value in
[
'Foox xu
foo',
@@ -2366,8 +2361,7 @@ test('tests from PHPTAL', function() {
'\n' +
'
\n' +
'foo