Socket
Socket
Sign inDemoInstall

html-minifier

Package Overview
Dependencies
2
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.6 to 0.6.0

CHANGELOG.md

264

dist/htmlminifier.js
/*!
* HTMLMinifier v0.5.6 (http://kangax.github.io/html-minifier/)
* HTMLMinifier v0.6.0 (http://kangax.github.io/html-minifier/)
* Copyright 2010-2014 Juriy "kangax" Zaytsev

@@ -224,7 +224,7 @@ * Licensed under MIT (https://github.com/kangax/html-minifier/blob/gh-pages/LICENSE)

arguments[4] ? arguments[4] :
fillAttrs[name] ? name : '';
fillAttrs[name] ? name : arguments[2];
attrs.push({
name: name,
value: value,
escaped: value.replace(/(^|[^\\])"/g, '$1"') //"
escaped: value && value.replace(/(^|[^\\])"/g, '$1"') //"
});

@@ -411,2 +411,4 @@ });

/* global CleanCSS */
(function(global) {

@@ -446,14 +448,20 @@ 'use strict';

function collapseWhitespaceSmart(str, prevTag, nextTag) {
// array of tags that will maintain a single space outside of them
var tags = ['a', 'abbr', 'acronym', 'b', 'bdi', 'bdo', 'big', 'button', 'cite', 'code', 'del', 'dfn', 'em', 'font', 'i', 'ins', 'kbd', 'mark', 'q', 'rt', 'rp', 's', 'samp', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'time', 'tt', 'u', 'var'];
function collapseWhitespaceSmart(str, prevTag, nextTag, options) {
if (prevTag && prevTag !== 'img' && (prevTag.substr(0,1) !== '/'
// array of non-empty element tags that will maintain a single space outside of them
var tags = [
'a', 'abbr', 'acronym', 'b', 'bdi', 'bdo', 'big', 'button', 'cite',
'code', 'del', 'dfn', 'em', 'font', 'i', 'ins', 'kbd', 'mark', 'q',
'rt', 'rp', 's', 'samp', 'small', 'span', 'strike', 'strong',
'sub', 'sup', 'time', 'tt', 'u', 'var'
];
if (prevTag && prevTag !== 'img' && prevTag !== 'input' && (prevTag.substr(0,1) !== '/'
|| ( prevTag.substr(0,1) === '/' && tags.indexOf(prevTag.substr(1)) === -1))) {
str = str.replace(/^\s+/, '');
str = str.replace(/^\s+/, options.conservativeCollapse ? ' ' : '');
}
if (nextTag && nextTag !== 'img' && (nextTag.substr(0,1) === '/'
if (nextTag && nextTag !== 'img' && nextTag !== 'input' && (nextTag.substr(0,1) === '/'
|| ( nextTag.substr(0,1) !== '/' && tags.indexOf(nextTag) === -1))) {
str = str.replace(/\s+$/, '');
str = str.replace(/\s+$/, options.conservativeCollapse ? ' ' : '');
}

@@ -473,4 +481,16 @@

function isIgnoredComment(text) {
return (/^!/).test(text);
function isIgnoredComment(text, options) {
if ((/^!/).test(text)) {
return true;
}
if (options.ignoreCustomComments) {
for (var i = 0, len = options.ignoreCustomComments.length; i < len; i++) {
if (options.ignoreCustomComments[i].test(text)) {
return true;
}
}
}
return false;
}

@@ -499,3 +519,4 @@

function isAttributeRedundant(tag, attrName, attrValue, attrs) {
attrValue = trimWhitespace(attrValue.toLowerCase());
attrValue = attrValue ? trimWhitespace(attrValue.toLowerCase()) : '';
return (

@@ -545,3 +566,3 @@ (tag === 'script' &&

function isBooleanAttribute(attrName) {
return (/^(?:allowfullscreen|async|autofocus|checked|compact|declare|default|defer|disabled|formnovalidate|hidden|inert|ismap|itemscope|multiple|muted|nohref|noresize|noshade|novalidate|nowrap|open|readonly|required|reversed|seamless|selected|sortable|truespeed|typemustmatch)$/).test(attrName);
return (/^(?:allowfullscreen|async|autofocus|autoplay|checked|compact|controls|declare|default|defaultchecked|defaultmuted|defaultselected|defer|disabled|draggable|enabled|formnovalidate|hidden|indeterminate|inert|ismap|itemscope|loop|multiple|muted|nohref|noresize|noshade|novalidate|nowrap|open|pauseonexit|readonly|required|reversed|scoped|seamless|selected|sortable|spellcheck|translate|truespeed|typemustmatch|visible)$/).test(attrName);
}

@@ -576,5 +597,11 @@

function cleanAttributeValue(tag, attrName, attrValue) {
function cleanAttributeValue(tag, attrName, attrValue, options, attrs) {
if (isEventAttribute(attrName)) {
return trimWhitespace(attrValue).replace(/^javascript:\s*/i, '').replace(/\s*;$/, '');
attrValue = trimWhitespace(attrValue).replace(/^javascript:\s*/i, '').replace(/\s*;$/, '');
if (options.minifyJS) {
var wrappedCode = '(function(){' + attrValue + '})()';
var minified = minifyJS(wrappedCode, options.minifyJS);
return minified.slice(12, minified.length - 4).replace(/"/g, '&quot;');
}
return attrValue;
}

@@ -588,7 +615,25 @@ else if (attrName === 'class') {

else if (attrName === 'style') {
return trimWhitespace(attrValue).replace(/\s*;\s*$/, '');
attrValue = trimWhitespace(attrValue).replace(/\s*;\s*$/, '');
if (options.minifyCSS) {
return minifyCSS(attrValue, options.minifyCSS);
}
return attrValue;
}
else if (isMetaViewport(tag, attrs) && attrName === 'content') {
attrValue = attrValue.replace(/1\.0/g, '1').replace(/\s+/g, '');
}
return attrValue;
}
function isMetaViewport(tag, attrs) {
if (tag !== 'meta') {
return false;
}
for (var i = 0, len = attrs.length; i < len; i++) {
if (attrs[i].name === 'name' && attrs[i].value === 'viewport') {
return true;
}
}
}
function cleanConditionalComment(comment) {

@@ -608,2 +653,11 @@ return comment

function processScript(text, options, currentAttrs) {
for (var i = 0, len = currentAttrs.length; i < len; i++) {
if (currentAttrs[i].name.toLowerCase() === 'type' &&
options.processScripts.indexOf(currentAttrs[i].value) > -1) {
return minify(text, options);
}
}
}
var reStartDelimiter = {

@@ -623,3 +677,3 @@ // account for js + html comments (e.g.: //<!--)

function isOptionalTag(tag) {
return (/^(?:html|t?body|t?head|tfoot|tr|td|th|option|source)$/).test(tag);
return (/^(?:html|t?body|t?head|tfoot|tr|td|th|dt|dd|option|colgroup|source)$/).test(tag);
}

@@ -653,2 +707,10 @@

function attrsToMarkup(attrs) {
var markup = '';
for (var i = 0, len = attrs.length; i < len; i++) {
markup += (' ' + attrs[i].name + (isBooleanAttribute(attrs[i].value) ? '' : ('="' + attrs[i].value + '"')));
}
return markup;
}
function normalizeAttribute(attr, attrs, tag, options) {

@@ -671,5 +733,5 @@

attrValue = cleanAttributeValue(tag, attrName, attrValue);
attrValue = cleanAttributeValue(tag, attrName, attrValue, options, attrs);
if (!options.removeAttributeQuotes ||
if (attrValue !== undefined && !options.removeAttributeQuotes ||
!canRemoveAttributeQuotes(attrValue)) {

@@ -684,4 +746,4 @@ attrValue = '"' + attrValue + '"';

if (options.collapseBooleanAttributes &&
isBooleanAttribute(attrName)) {
if (attrValue === undefined || (options.collapseBooleanAttributes &&
isBooleanAttribute(attrName))) {
attrFragment = attrName;

@@ -709,2 +771,77 @@ }

function minifyJS(text, options) {
if (typeof options !== 'object') {
options = { };
}
options.fromString = true;
options.output = { inline_script: true };
try {
// try to get global reference first
var __UglifyJS = global.UglifyJS;
if (typeof __UglifyJS === 'undefined' && typeof require === 'function') {
__UglifyJS = require('uglify-js');
}
// noop
if (!__UglifyJS) {
return text;
}
if (__UglifyJS.minify) {
return __UglifyJS.minify(text, options).code;
}
else if (__UglifyJS.parse) {
var ast = __UglifyJS.parse(text);
ast.figure_out_scope();
var compressor = __UglifyJS.Compressor();
var compressedAst = ast.transform(compressor);
compressedAst.figure_out_scope();
compressedAst.compute_char_frequency();
if (options.mangle !== false) {
compressedAst.mangle_names();
}
var stream = __UglifyJS.OutputStream(options.output);
compressedAst.print(stream);
return stream.toString();
}
else {
return text;
}
}
catch (err) {
log(err);
}
return text;
}
function minifyCSS(text, options) {
if (typeof options !== 'object') {
options = { };
}
if (typeof options.noAdvanced === 'undefined') {
options.noAdvanced = true;
}
try {
if (typeof CleanCSS !== 'undefined') {
return new CleanCSS(options).minify(text);
}
else if (typeof require === 'function') {
var CleanCSSModule = require('clean-css');
return new CleanCSSModule(options).minify(text);
}
}
catch (err) {
log(err);
}
return text;
}
function minify(value, options) {

@@ -724,2 +861,3 @@

lint = options.lint,
isIgnoring = false,
t = new Date();

@@ -739,2 +877,8 @@

start: function( tag, attrs, unary, unarySlash ) {
if (isIgnoring) {
buffer.push('<', tag, attrsToMarkup(attrs), unarySlash ? '/' : '', '>');
return;
}
tag = tag.toLowerCase();

@@ -766,2 +910,8 @@ currentTag = tag;

end: function( tag ) {
if (isIgnoring) {
buffer.push('</', tag, '>');
return;
}
// check if current tag is in a whitespace stack

@@ -799,2 +949,7 @@ if (options.collapseWhitespace) {

chars: function( text, prevTag, nextTag ) {
if (isIgnoring) {
buffer.push(text);
return;
}
if (currentTag === 'script' || currentTag === 'style') {

@@ -807,6 +962,17 @@ if (options.removeCommentsFromCDATA) {

}
if (options.processScripts) {
text = processScript(text, options, currentAttrs);
}
}
if (currentTag === 'script' && options.minifyJS) {
text = minifyJS(text, options.minifyJS);
}
if (currentTag === 'style' && options.minifyCSS) {
text = minifyCSS(text, options.minifyCSS);
}
if (options.collapseWhitespace) {
if (!stackNoTrimWhitespace.length) {
text = (prevTag || nextTag) ? collapseWhitespaceSmart(text, prevTag, nextTag) : trimWhitespace(text);
text = (prevTag || nextTag) ?
collapseWhitespaceSmart(text, prevTag, nextTag, options)
: trimWhitespace(text);
}

@@ -822,2 +988,7 @@ if (!stackNoCollapseWhitespace.length) {

comment: function( text ) {
if (/^\s*htmlmin:ignore/.test(text)) {
isIgnoring = !isIgnoring;
buffer.push('<!--' + text + '-->');
return;
}
if (options.removeComments) {

@@ -827,3 +998,3 @@ if (isConditionalComment(text)) {

}
else if (isIgnoredComment(text)) {
else if (isIgnoredComment(text, options)) {
text = '<!--' + text + '-->';

@@ -940,4 +1111,4 @@ }

this.log.push(
'<li>Found <span class="deprecated-element">deprecated</span> <strong><code>&lt;' +
tag + '&gt;</code></strong> element</li>'
'Found <span class="deprecated-element">deprecated</span> <strong><code>&lt;' +
tag + '&gt;</code></strong> element'
);

@@ -947,4 +1118,4 @@ }

this.log.push(
'<li>Found <span class="presentational-element">presentational</span> <strong><code>&lt;' +
tag + '&gt;</code></strong> element</li>'
'Found <span class="presentational-element">presentational</span> <strong><code>&lt;' +
tag + '&gt;</code></strong> element'
);

@@ -969,3 +1140,3 @@ }

Lint.prototype._reportRepeatingElement = function() {
this.log.push('<li>Found <code>&lt;br></code> sequence. Try replacing it with styling.</li>');
this.log.push('Found <code>&lt;br></code> sequence. Try replacing it with styling.');
};

@@ -976,4 +1147,4 @@

this.log.push(
'<li>Found <span class="event-attribute">event attribute</span> (<strong>',
attrName, '</strong>) on <strong><code>&lt;' + tag + '&gt;</code></strong> element</li>'
'Found <span class="event-attribute">event attribute</span> (<strong>' +
attrName + '</strong>) on <strong><code>&lt;' + tag + '&gt;</code></strong> element.'
);

@@ -983,4 +1154,4 @@ }

this.log.push(
'<li>Found <span class="deprecated-attribute">deprecated</span> <strong>' +
attrName + '</strong> attribute on <strong><code>&lt;', tag, '&gt;</code></strong> element</li>'
'Found <span class="deprecated-attribute">deprecated</span> <strong>' +
attrName + '</strong> attribute on <strong><code>&lt;' + tag + '&gt;</code></strong> element.'
);

@@ -990,3 +1161,4 @@ }

this.log.push(
'<li>Found <span class="style-attribute">style attribute</span> on <strong><code>&lt;', tag, '&gt;</code></strong> element</li>'
'Found <span class="style-attribute">style attribute</span> on <strong><code>&lt;' +
tag + '&gt;</code></strong> element.'
);

@@ -996,4 +1168,4 @@ }

this.log.push(
'<li>Found <span class="inaccessible-attribute">inaccessible attribute</span> ' +
'(on <strong><code>&lt;', tag, '&gt;</code></strong> element)</li>'
'Found <span class="inaccessible-attribute">inaccessible attribute</span> ' +
'(on <strong><code>&lt;' + tag + '&gt;</code></strong> element).'
);

@@ -1006,3 +1178,3 @@ }

if (/(&nbsp;\s*){2,}/.test(chars)) {
this.log.push('<li>Found repeating <strong><code>&amp;nbsp;</code></strong> sequence. Try replacing it with styling.</li>');
this.log.push('Found repeating <strong><code>&amp;nbsp;</code></strong> sequence. Try replacing it with styling.');
}

@@ -1020,6 +1192,16 @@ };

}
var report;
if (this.log.length && writeToElement) {
report = '<ol>' + this.log.join('') + '</ol>';
writeToElement.innerHTML = report;
if (this.log.length) {
if (writeToElement) {
writeToElement.innerHTML = '<ol><li>' + this.log.join('<li>') + '</ol>';
}
else {
var output = ' - ' +
this.log.join('\n - ')
.replace(/(<([^>]+)>)/ig, '')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>');
console.log(output);
}
}

@@ -1026,0 +1208,0 @@ };

4

dist/htmlminifier.min.js
/*!
* HTMLMinifier v0.5.6 (http://kangax.github.io/html-minifier/)
* HTMLMinifier v0.6.0 (http://kangax.github.io/html-minifier/)
* Copyright 2010-2014 Juriy "kangax" Zaytsev
* Licensed under MIT (https://github.com/kangax/html-minifier/blob/gh-pages/LICENSE)
*/
!function(a){"use strict";function b(a){for(var b={},c=a.split(","),d=0;d<c.length;d++)b[c[d]]=!0,b[c[d].toUpperCase()]=!0;return b}var c,d,e,f=/^<([\w:-]+)((?:\s*[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,g=/^<\/([\w:-]+)[^>]*>/,h=/\/>$/,i=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,j=/^<!DOCTYPE [^>]+>/i,k=/<(%|\?)/,l=/(%|\?)>/,m=b("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),n=b("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),o=b("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),p=b("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),q=b("script,style"),r={},s=a.HTMLParser=function(a,b){function s(a,c,d,e){for(var f=!1;!b.html5&&z.last()&&n[z.last()];)t("",z.last());if(o[c]&&z.last()===c&&t("",c),e=m[c]||!!e,e?f=a.match(h):z.push(c),b.start){var g=[];d.replace(i,function(a,b){var c=arguments[2]?arguments[2]:arguments[3]?arguments[3]:arguments[4]?arguments[4]:p[b]?b:"";g.push({name:b,value:c,escaped:c.replace(/(^|[^\\])"/g,"$1&quot;")})}),b.start&&b.start(c,g,e,f)}}function t(a,c){var d;if(c)for(d=z.length-1;d>=0&&z[d]!==c;d--);else d=0;if(d>=0){for(var e=z.length-1;e>=d;e--)b.end&&b.end(z[e]);z.length=d}}var u,v,w,x,y,z=[],A=a;for(z.last=function(){return this[this.length-1]};a;){if(v=!0,z.last()&&q[z.last()])c=z.last().toLowerCase(),d=r[c]||(r[c]=new RegExp("([\\s\\S]*?)</"+c+"[^>]*>","i")),a=a.replace(d,function(a,d){return"script"!==c&&"style"!==c&&(d=d.replace(/<!--([\s\S]*?)-->/g,"$1").replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g,"$1")),b.chars&&b.chars(d),""}),t("",c);else if(0===a.indexOf("<!--")?(u=a.indexOf("-->"),u>=0&&(b.comment&&b.comment(a.substring(4,u)),a=a.substring(u+3),v=!1)):0===a.search(k)?(u=a.search(l),u>=0&&(b.ignore&&b.ignore(a.substring(0,u+2)),a=a.substring(u+2),v=!1)):(w=j.exec(a))?(b.doctype&&b.doctype(w[0]),a=a.substring(w[0].length),v=!1):0===a.indexOf("</")?(w=a.match(g),w&&(a=a.substring(w[0].length),w[0].replace(g,t),x="/"+w[1],v=!1)):0===a.indexOf("<")&&(w=a.match(f),w&&(a=a.substring(w[0].length),w[0].replace(f,s),x=w[1],v=!1)),v){u=a.indexOf("<");var B=0>u?a:a.substring(0,u);a=0>u?"":a.substring(u),e=a.match(f),e?y=e[1]:(e=a.match(g),y=e?"/"+e[1]:""),b.chars&&b.chars(B,x,y)}if(a===A)throw"Parse Error: "+a;A=a}t()};a.HTMLtoXML=function(a){var b="";return new s(a,{start:function(a,c,d){b+="<"+a;for(var e=0;e<c.length;e++)b+=" "+c[e].name+'="'+c[e].escaped+'"';b+=(d?"/":"")+">"},end:function(a){b+="</"+a+">"},chars:function(a){b+=a},comment:function(a){b+="<!--"+a+"-->"},ignore:function(a){b+=a}}),b},a.HTMLtoDOM=function(a,c){var d=b("html,head,body,title"),e={link:"head",base:"head"};c?c=c.ownerDocument||c.getOwnerDocument&&c.getOwnerDocument()||c:"undefined"!=typeof DOMDocument?c=new DOMDocument:"undefined"!=typeof document&&document.implementation&&document.implementation.createDocument?c=document.implementation.createDocument("","",null):"undefined"!=typeof ActiveX&&(c=new ActiveXObject("Msxml.DOMDocument"));var f=[],g=c.documentElement||c.getDocumentElement&&c.getDocumentElement();if(!g&&c.createElement&&!function(){var a=c.createElement("html"),b=c.createElement("head");b.appendChild(c.createElement("title")),a.appendChild(b),a.appendChild(c.createElement("body")),c.appendChild(a)}(),c.getElementsByTagName)for(var h in d)d[h]=c.getElementsByTagName(h)[0];var i=d.body;return new s(a,{start:function(a,b,g){if(d[a])return void(i=d[a]);var h=c.createElement(a);for(var j in b)h.setAttribute(b[j].name,b[j].value);e[a]&&"boolean"!=typeof d[e[a]]?d[e[a]].appendChild(h):i&&i.appendChild&&i.appendChild(h),g||(f.push(h),i=h)},end:function(){f.length-=1,i=f[f.length-1]},chars:function(a){i.appendChild(c.createTextNode(a))},comment:function(){},ignore:function(){}}),c}}("undefined"==typeof exports?this:exports),function(a){"use strict";function b(a){return a.replace(/\s+/g," ")}function c(a,b,c){var d=["a","abbr","acronym","b","bdi","bdo","big","button","cite","code","del","dfn","em","font","i","ins","kbd","mark","q","rt","rp","s","samp","small","span","strike","strong","sub","sup","time","tt","u","var"];return b&&"img"!==b&&("/"!==b.substr(0,1)||"/"===b.substr(0,1)&&-1===d.indexOf(b.substr(1)))&&(a=a.replace(/^\s+/,"")),c&&"img"!==c&&("/"===c.substr(0,1)||"/"!==c.substr(0,1)&&-1===d.indexOf(c))&&(a=a.replace(/\s+$/,"")),b&&c?a.replace(/[\t\n\r]+/g," ").replace(/[ ]+/g," "):a}function d(a){return/\[if[^\]]+\]/.test(a)||/\s*(<!\[endif\])$/.test(a)}function e(a){return/^!/.test(a)}function f(a){return/^on[a-z]+/.test(a)}function g(a){return/^[^\x20\t\n\f\r"'`=<>]+$/.test(a)&&!/\/$/.test(a)&&!/\/$/.test(a)}function h(a,b){for(var c=a.length;c--;)if(a[c].name.toLowerCase()===b)return!0;return!1}function i(a,b,c,d){return c=C(c.toLowerCase()),"script"===a&&"language"===b&&"javascript"===c||"form"===a&&"method"===b&&"get"===c||"input"===a&&"type"===b&&"text"===c||"script"===a&&"charset"===b&&!h(d,"src")||"a"===a&&"name"===b&&h(d,"id")||"area"===a&&"shape"===b&&"rect"===c}function j(a,b,c){return"script"===a&&"type"===b&&"text/javascript"===C(c.toLowerCase())}function k(a,b,c){return("style"===a||"link"===a)&&"type"===b&&"text/css"===C(c.toLowerCase())}function l(a){return/^(?:allowfullscreen|async|autofocus|checked|compact|declare|default|defer|disabled|formnovalidate|hidden|inert|ismap|itemscope|multiple|muted|nohref|noresize|noshade|novalidate|nowrap|open|readonly|required|reversed|seamless|selected|sortable|truespeed|typemustmatch)$/.test(a)}function m(a,b){return/^(?:a|area|link|base)$/.test(b)&&"href"===a||"img"===b&&/^(?:src|longdesc|usemap)$/.test(a)||"object"===b&&/^(?:classid|codebase|data|usemap)$/.test(a)||"q"===b&&"cite"===a||"blockquote"===b&&"cite"===a||("ins"===b||"del"===b)&&"cite"===a||"form"===b&&"action"===a||"input"===b&&("src"===a||"usemap"===a)||"head"===b&&"profile"===a||"script"===b&&("src"===a||"for"===a)}function n(a,b){return/^(?:a|area|object|button)$/.test(b)&&"tabindex"===a||"input"===b&&("maxlength"===a||"tabindex"===a)||"select"===b&&("size"===a||"tabindex"===a)||"textarea"===b&&/^(?:rows|cols|tabindex)$/.test(a)||"colgroup"===b&&"span"===a||"col"===b&&"span"===a||("th"===b||"td"===b)&&("rowspan"===a||"colspan"===a)}function o(a,c,d){return f(c)?C(d).replace(/^javascript:\s*/i,"").replace(/\s*;$/,""):"class"===c?b(C(d)):m(c,a)||n(c,a)?C(d):"style"===c?C(d).replace(/\s*;\s*$/,""):d}function p(a){return a.replace(/^(\[[^\]]+\]>)\s*/,"$1").replace(/\s*(<!\[endif\])$/,"$1")}function q(a){return a.replace(/^(?:\s*\/\*\s*<!\[CDATA\[\s*\*\/|\s*\/\/\s*<!\[CDATA\[.*)/,"").replace(/(?:\/\*\s*\]\]>\s*\*\/|\/\/\s*\]\]>)\s*$/,"")}function r(a,b){return a.replace(D[b],"").replace(E[b],"")}function s(a){return/^(?:html|t?body|t?head|tfoot|tr|td|th|option|source)$/.test(a)}function t(a,b,c){var d=/^(["'])?\s*\1$/.test(c);return d?"input"===a&&"value"===b||F.test(b):!1}function u(a){return"textarea"!==a}function v(a){return!/^(?:script|style|pre|textarea)$/.test(a)}function w(a){return!/^(?:pre|textarea)$/.test(a)}function x(a,b,c,d){var e,f=d.caseSensitive?a.name:a.name.toLowerCase(),h=a.escaped;return d.removeRedundantAttributes&&i(c,f,h,b)||d.removeScriptTypeAttributes&&j(c,f,h)||d.removeStyleLinkTypeAttributes&&k(c,f,h)?"":(h=o(c,f,h),d.removeAttributeQuotes&&g(h)||(h='"'+h+'"'),d.removeEmptyAttributes&&t(c,f,h)?"":(e=d.collapseBooleanAttributes&&l(f)?f:f+"="+h," "+e))}function y(a){for(var b=["canCollapseWhitespace","canTrimWhitespace"],c=0,d=b.length;d>c;c++)a[b[c]]||(a[b[c]]=function(){return!1})}function z(a,f){function g(a,b){return v(a)||f.canCollapseWhitespace(a,b)}function h(a,b){return w(a)||f.canTrimWhitespace(a,b)}f=f||{},a=C(a),y(f);var i=[],j=[],k="",l="",m=[],n=[],o=[],t=f.lint,z=new Date;new B(a,{html5:"undefined"!=typeof f.html5?f.html5:!0,start:function(a,b,c,d){a=a.toLowerCase(),l=a,k="",m=b,f.collapseWhitespace&&(h(a,b)||n.push(a),g(a,b)||o.push(a)),j.push("<",a),t&&t.testElement(a);for(var e=0,i=b.length;i>e;e++)t&&t.testAttribute(a,b[e].name.toLowerCase(),b[e].escaped),j.push(x(b[e],b,a,f));j.push((d&&f.keepClosingSlash?"/":"")+">")},end:function(a){f.collapseWhitespace&&(n.length&&a===n[n.length-1]&&n.pop(),o.length&&a===o[o.length-1]&&o.pop());var b=""===k&&a===l;return f.removeEmptyElements&&b&&u(a)?void j.splice(j.lastIndexOf("<")):void(f.removeOptionalTags&&s(a)||(j.push("</",a.toLowerCase(),">"),i.push.apply(i,j),j.length=0,k=""))},chars:function(a,d,e){("script"===l||"style"===l)&&(f.removeCommentsFromCDATA&&(a=r(a,l)),f.removeCDATASectionsFromCDATA&&(a=q(a))),f.collapseWhitespace&&(n.length||(a=d||e?c(a,d,e):C(a)),o.length||(a=b(a))),k=a,t&&t.testChars(a),j.push(a)},comment:function(a){a=f.removeComments?d(a)?"<!--"+p(a)+"-->":e(a)?"<!--"+a+"-->":"":"<!--"+a+"-->",j.push(a)},ignore:function(a){j.push(f.removeIgnored?"":a)},doctype:function(a){j.push(f.useShortDoctype?"<!DOCTYPE html>":b(a))}}),i.push.apply(i,j);var D=i.join("");return A("minified in: "+(new Date-z)+"ms"),D}var A,B;A=a.console&&a.console.log?function(b){a.console.log(b)}:function(){},a.HTMLParser?B=a.HTMLParser:"function"==typeof require&&(B=require("./htmlparser").HTMLParser);var C=function(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")};String.prototype.trim&&(C=function(a){return a.trim()});var D={script:/^\s*(?:\/\/)?\s*<!--.*\n?/,style:/^\s*<!--\s*/},E={script:/\s*(?:\/\/)?\s*-->\s*$/,style:/\s*-->\s*$/},F=new RegExp("^(?:class|id|style|title|lang|dir|on(?:focus|blur|change|click|dblclick|mouse(?:down|up|over|move|out)|key(?:press|down|up)))$");"undefined"!=typeof exports?exports.minify=z:a.minify=z}(this),function(a){"use strict";function b(a){return/^(?:b|i|big|small|hr|blink|marquee)$/.test(a)}function c(a){return/^(?:applet|basefont|center|dir|font|isindex|s|strike|u)$/.test(a)}function d(a){return/^on[a-z]+/.test(a)}function e(a){return"style"===a.toLowerCase()}function f(a,b){return"align"===b&&/^(?:caption|applet|iframe|img|imput|object|legend|table|hr|div|h[1-6]|p)$/.test(a)||"alink"===b&&"body"===a||"alt"===b&&"applet"===a||"archive"===b&&"applet"===a||"background"===b&&"body"===a||"bgcolor"===b&&/^(?:table|t[rdh]|body)$/.test(a)||"border"===b&&/^(?:img|object)$/.test(a)||"clear"===b&&"br"===a||"code"===b&&"applet"===a||"codebase"===b&&"applet"===a||"color"===b&&/^(?:base(?:font)?)$/.test(a)||"compact"===b&&/^(?:dir|[dou]l|menu)$/.test(a)||"face"===b&&/^base(?:font)?$/.test(a)||"height"===b&&/^(?:t[dh]|applet)$/.test(a)||"hspace"===b&&/^(?:applet|img|object)$/.test(a)||"language"===b&&"script"===a||"link"===b&&"body"===a||"name"===b&&"applet"===a||"noshade"===b&&"hr"===a||"nowrap"===b&&/^t[dh]$/.test(a)||"object"===b&&"applet"===a||"prompt"===b&&"isindex"===a||"size"===b&&/^(?:hr|font|basefont)$/.test(a)||"start"===b&&"ol"===a||"text"===b&&"body"===a||"type"===b&&/^(?:li|ol|ul)$/.test(a)||"value"===b&&"li"===a||"version"===b&&"html"===a||"vlink"===b&&"body"===a||"vspace"===b&&/^(?:applet|img|object)$/.test(a)||"width"===b&&/^(?:hr|td|th|applet|pre)$/.test(a)}function g(a,b){return"href"===a&&/^\s*javascript\s*:\s*void\s*(\s+0|\(\s*0\s*\))\s*$/i.test(b)}function h(){this.log=[],this._lastElement=null,this._isElementRepeated=!1}h.prototype.testElement=function(a){c(a)?this.log.push('<li>Found <span class="deprecated-element">deprecated</span> <strong><code>&lt;'+a+"&gt;</code></strong> element</li>"):b(a)?this.log.push('<li>Found <span class="presentational-element">presentational</span> <strong><code>&lt;'+a+"&gt;</code></strong> element</li>"):this.checkRepeatingElement(a)},h.prototype.checkRepeatingElement=function(a){"br"===a&&"br"===this._lastElement?this._isElementRepeated=!0:this._isElementRepeated&&(this._reportRepeatingElement(),this._isElementRepeated=!1),this._lastElement=a},h.prototype._reportRepeatingElement=function(){this.log.push("<li>Found <code>&lt;br></code> sequence. Try replacing it with styling.</li>")},h.prototype.testAttribute=function(a,b,c){d(b)?this.log.push('<li>Found <span class="event-attribute">event attribute</span> (<strong>',b,"</strong>) on <strong><code>&lt;"+a+"&gt;</code></strong> element</li>"):f(a,b)?this.log.push('<li>Found <span class="deprecated-attribute">deprecated</span> <strong>'+b+"</strong> attribute on <strong><code>&lt;",a,"&gt;</code></strong> element</li>"):e(b)?this.log.push('<li>Found <span class="style-attribute">style attribute</span> on <strong><code>&lt;',a,"&gt;</code></strong> element</li>"):g(b,c)&&this.log.push('<li>Found <span class="inaccessible-attribute">inaccessible attribute</span> (on <strong><code>&lt;',a,"&gt;</code></strong> element)</li>")},h.prototype.testChars=function(a){this._lastElement="",/(&nbsp;\s*){2,}/.test(a)&&this.log.push("<li>Found repeating <strong><code>&amp;nbsp;</code></strong> sequence. Try replacing it with styling.</li>")},h.prototype.test=function(a,b,c){this.testElement(a),this.testAttribute(a,b,c)},h.prototype.populate=function(a){this._isElementRepeated&&this._reportRepeatingElement();var b;this.log.length&&a&&(b="<ol>"+this.log.join("")+"</ol>",a.innerHTML=b)},a.HTMLLint=h}("undefined"==typeof exports?this:exports);
!function(a){"use strict";function b(a){for(var b={},c=a.split(","),d=0;d<c.length;d++)b[c[d]]=!0,b[c[d].toUpperCase()]=!0;return b}var c,d,e,f=/^<([\w:-]+)((?:\s*[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,g=/^<\/([\w:-]+)[^>]*>/,h=/\/>$/,i=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,j=/^<!DOCTYPE [^>]+>/i,k=/<(%|\?)/,l=/(%|\?)>/,m=b("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),n=b("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),o=b("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),p=b("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),q=b("script,style"),r={},s=a.HTMLParser=function(a,b){function s(a,c,d,e){for(var f=!1;!b.html5&&z.last()&&n[z.last()];)t("",z.last());if(o[c]&&z.last()===c&&t("",c),e=m[c]||!!e,e?f=a.match(h):z.push(c),b.start){var g=[];d.replace(i,function(a,b){var c=arguments[2]?arguments[2]:arguments[3]?arguments[3]:arguments[4]?arguments[4]:p[b]?b:arguments[2];g.push({name:b,value:c,escaped:c&&c.replace(/(^|[^\\])"/g,"$1&quot;")})}),b.start&&b.start(c,g,e,f)}}function t(a,c){var d;if(c)for(d=z.length-1;d>=0&&z[d]!==c;d--);else d=0;if(d>=0){for(var e=z.length-1;e>=d;e--)b.end&&b.end(z[e]);z.length=d}}var u,v,w,x,y,z=[],A=a;for(z.last=function(){return this[this.length-1]};a;){if(v=!0,z.last()&&q[z.last()])c=z.last().toLowerCase(),d=r[c]||(r[c]=new RegExp("([\\s\\S]*?)</"+c+"[^>]*>","i")),a=a.replace(d,function(a,d){return"script"!==c&&"style"!==c&&(d=d.replace(/<!--([\s\S]*?)-->/g,"$1").replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g,"$1")),b.chars&&b.chars(d),""}),t("",c);else if(0===a.indexOf("<!--")?(u=a.indexOf("-->"),u>=0&&(b.comment&&b.comment(a.substring(4,u)),a=a.substring(u+3),v=!1)):0===a.search(k)?(u=a.search(l),u>=0&&(b.ignore&&b.ignore(a.substring(0,u+2)),a=a.substring(u+2),v=!1)):(w=j.exec(a))?(b.doctype&&b.doctype(w[0]),a=a.substring(w[0].length),v=!1):0===a.indexOf("</")?(w=a.match(g),w&&(a=a.substring(w[0].length),w[0].replace(g,t),x="/"+w[1],v=!1)):0===a.indexOf("<")&&(w=a.match(f),w&&(a=a.substring(w[0].length),w[0].replace(f,s),x=w[1],v=!1)),v){u=a.indexOf("<");var B=0>u?a:a.substring(0,u);a=0>u?"":a.substring(u),e=a.match(f),e?y=e[1]:(e=a.match(g),y=e?"/"+e[1]:""),b.chars&&b.chars(B,x,y)}if(a===A)throw"Parse Error: "+a;A=a}t()};a.HTMLtoXML=function(a){var b="";return new s(a,{start:function(a,c,d){b+="<"+a;for(var e=0;e<c.length;e++)b+=" "+c[e].name+'="'+c[e].escaped+'"';b+=(d?"/":"")+">"},end:function(a){b+="</"+a+">"},chars:function(a){b+=a},comment:function(a){b+="<!--"+a+"-->"},ignore:function(a){b+=a}}),b},a.HTMLtoDOM=function(a,c){var d=b("html,head,body,title"),e={link:"head",base:"head"};c?c=c.ownerDocument||c.getOwnerDocument&&c.getOwnerDocument()||c:"undefined"!=typeof DOMDocument?c=new DOMDocument:"undefined"!=typeof document&&document.implementation&&document.implementation.createDocument?c=document.implementation.createDocument("","",null):"undefined"!=typeof ActiveX&&(c=new ActiveXObject("Msxml.DOMDocument"));var f=[],g=c.documentElement||c.getDocumentElement&&c.getDocumentElement();if(!g&&c.createElement&&!function(){var a=c.createElement("html"),b=c.createElement("head");b.appendChild(c.createElement("title")),a.appendChild(b),a.appendChild(c.createElement("body")),c.appendChild(a)}(),c.getElementsByTagName)for(var h in d)d[h]=c.getElementsByTagName(h)[0];var i=d.body;return new s(a,{start:function(a,b,g){if(d[a])return void(i=d[a]);var h=c.createElement(a);for(var j in b)h.setAttribute(b[j].name,b[j].value);e[a]&&"boolean"!=typeof d[e[a]]?d[e[a]].appendChild(h):i&&i.appendChild&&i.appendChild(h),g||(f.push(h),i=h)},end:function(){f.length-=1,i=f[f.length-1]},chars:function(a){i.appendChild(c.createTextNode(a))},comment:function(){},ignore:function(){}}),c}}("undefined"==typeof exports?this:exports),function(a){"use strict";function b(a){return a.replace(/\s+/g," ")}function c(a,b,c,d){var e=["a","abbr","acronym","b","bdi","bdo","big","button","cite","code","del","dfn","em","font","i","ins","kbd","mark","q","rt","rp","s","samp","small","span","strike","strong","sub","sup","time","tt","u","var"];return b&&"img"!==b&&"input"!==b&&("/"!==b.substr(0,1)||"/"===b.substr(0,1)&&-1===e.indexOf(b.substr(1)))&&(a=a.replace(/^\s+/,d.conservativeCollapse?" ":"")),c&&"img"!==c&&"input"!==c&&("/"===c.substr(0,1)||"/"!==c.substr(0,1)&&-1===e.indexOf(c))&&(a=a.replace(/\s+$/,d.conservativeCollapse?" ":"")),b&&c?a.replace(/[\t\n\r]+/g," ").replace(/[ ]+/g," "):a}function d(a){return/\[if[^\]]+\]/.test(a)||/\s*(<!\[endif\])$/.test(a)}function e(a,b){if(/^!/.test(a))return!0;if(b.ignoreCustomComments)for(var c=0,d=b.ignoreCustomComments.length;d>c;c++)if(b.ignoreCustomComments[c].test(a))return!0;return!1}function f(a){return/^on[a-z]+/.test(a)}function g(a){return/^[^\x20\t\n\f\r"'`=<>]+$/.test(a)&&!/\/$/.test(a)&&!/\/$/.test(a)}function h(a,b){for(var c=a.length;c--;)if(a[c].name.toLowerCase()===b)return!0;return!1}function i(a,b,c,d){return c=c?H(c.toLowerCase()):"","script"===a&&"language"===b&&"javascript"===c||"form"===a&&"method"===b&&"get"===c||"input"===a&&"type"===b&&"text"===c||"script"===a&&"charset"===b&&!h(d,"src")||"a"===a&&"name"===b&&h(d,"id")||"area"===a&&"shape"===b&&"rect"===c}function j(a,b,c){return"script"===a&&"type"===b&&"text/javascript"===H(c.toLowerCase())}function k(a,b,c){return("style"===a||"link"===a)&&"type"===b&&"text/css"===H(c.toLowerCase())}function l(a){return/^(?:allowfullscreen|async|autofocus|autoplay|checked|compact|controls|declare|default|defaultchecked|defaultmuted|defaultselected|defer|disabled|draggable|enabled|formnovalidate|hidden|indeterminate|inert|ismap|itemscope|loop|multiple|muted|nohref|noresize|noshade|novalidate|nowrap|open|pauseonexit|readonly|required|reversed|scoped|seamless|selected|sortable|spellcheck|translate|truespeed|typemustmatch|visible)$/.test(a)}function m(a,b){return/^(?:a|area|link|base)$/.test(b)&&"href"===a||"img"===b&&/^(?:src|longdesc|usemap)$/.test(a)||"object"===b&&/^(?:classid|codebase|data|usemap)$/.test(a)||"q"===b&&"cite"===a||"blockquote"===b&&"cite"===a||("ins"===b||"del"===b)&&"cite"===a||"form"===b&&"action"===a||"input"===b&&("src"===a||"usemap"===a)||"head"===b&&"profile"===a||"script"===b&&("src"===a||"for"===a)}function n(a,b){return/^(?:a|area|object|button)$/.test(b)&&"tabindex"===a||"input"===b&&("maxlength"===a||"tabindex"===a)||"select"===b&&("size"===a||"tabindex"===a)||"textarea"===b&&/^(?:rows|cols|tabindex)$/.test(a)||"colgroup"===b&&"span"===a||"col"===b&&"span"===a||("th"===b||"td"===b)&&("rowspan"===a||"colspan"===a)}function o(a,c,d,e,g){if(f(c)){if(d=H(d).replace(/^javascript:\s*/i,"").replace(/\s*;$/,""),e.minifyJS){var h="(function(){"+d+"})()",i=C(h,e.minifyJS);return i.slice(12,i.length-4).replace(/"/g,"&quot;")}return d}return"class"===c?b(H(d)):m(c,a)||n(c,a)?H(d):"style"===c?(d=H(d).replace(/\s*;\s*$/,""),e.minifyCSS?D(d,e.minifyCSS):d):(p(a,g)&&"content"===c&&(d=d.replace(/1\.0/g,"1").replace(/\s+/g,"")),d)}function p(a,b){if("meta"!==a)return!1;for(var c=0,d=b.length;d>c;c++)if("name"===b[c].name&&"viewport"===b[c].value)return!0}function q(a){return a.replace(/^(\[[^\]]+\]>)\s*/,"$1").replace(/\s*(<!\[endif\])$/,"$1")}function r(a){return a.replace(/^(?:\s*\/\*\s*<!\[CDATA\[\s*\*\/|\s*\/\/\s*<!\[CDATA\[.*)/,"").replace(/(?:\/\*\s*\]\]>\s*\*\/|\/\/\s*\]\]>)\s*$/,"")}function s(a,b,c){for(var d=0,e=c.length;e>d;d++)if("type"===c[d].name.toLowerCase()&&b.processScripts.indexOf(c[d].value)>-1)return E(a,b)}function t(a,b){return a.replace(I[b],"").replace(J[b],"")}function u(a){return/^(?:html|t?body|t?head|tfoot|tr|td|th|dt|dd|option|colgroup|source)$/.test(a)}function v(a,b,c){var d=/^(["'])?\s*\1$/.test(c);return d?"input"===a&&"value"===b||K.test(b):!1}function w(a){return"textarea"!==a}function x(a){return!/^(?:script|style|pre|textarea)$/.test(a)}function y(a){return!/^(?:pre|textarea)$/.test(a)}function z(a){for(var b="",c=0,d=a.length;d>c;c++)b+=" "+a[c].name+(l(a[c].value)?"":'="'+a[c].value+'"');return b}function A(a,b,c,d){var e,f=d.caseSensitive?a.name:a.name.toLowerCase(),h=a.escaped;return d.removeRedundantAttributes&&i(c,f,h,b)||d.removeScriptTypeAttributes&&j(c,f,h)||d.removeStyleLinkTypeAttributes&&k(c,f,h)?"":(h=o(c,f,h,d,b),(void 0!==h&&!d.removeAttributeQuotes||!g(h))&&(h='"'+h+'"'),d.removeEmptyAttributes&&v(c,f,h)?"":(e=void 0===h||d.collapseBooleanAttributes&&l(f)?f:f+"="+h," "+e))}function B(a){for(var b=["canCollapseWhitespace","canTrimWhitespace"],c=0,d=b.length;d>c;c++)a[b[c]]||(a[b[c]]=function(){return!1})}function C(b,c){"object"!=typeof c&&(c={}),c.fromString=!0,c.output={inline_script:!0};try{var d=a.UglifyJS;if("undefined"==typeof d&&"function"==typeof require&&(d=require("uglify-js")),!d)return b;if(d.minify)return d.minify(b,c).code;if(d.parse){var e=d.parse(b);e.figure_out_scope();var f=d.Compressor(),g=e.transform(f);g.figure_out_scope(),g.compute_char_frequency(),c.mangle!==!1&&g.mangle_names();var h=d.OutputStream(c.output);return g.print(h),h.toString()}return b}catch(i){F(i)}return b}function D(a,b){"object"!=typeof b&&(b={}),"undefined"==typeof b.noAdvanced&&(b.noAdvanced=!0);try{if("undefined"!=typeof CleanCSS)return new CleanCSS(b).minify(a);if("function"==typeof require){var c=require("clean-css");return new c(b).minify(a)}}catch(d){F(d)}return a}function E(a,f){function g(a,b){return x(a)||f.canCollapseWhitespace(a,b)}function h(a,b){return y(a)||f.canTrimWhitespace(a,b)}f=f||{},a=H(a),B(f);var i=[],j=[],k="",l="",m=[],n=[],o=[],p=f.lint,v=!1,E=new Date;new G(a,{html5:"undefined"!=typeof f.html5?f.html5:!0,start:function(a,b,c,d){if(v)return void j.push("<",a,z(b),d?"/":"",">");a=a.toLowerCase(),l=a,k="",m=b,f.collapseWhitespace&&(h(a,b)||n.push(a),g(a,b)||o.push(a)),j.push("<",a),p&&p.testElement(a);for(var e=0,i=b.length;i>e;e++)p&&p.testAttribute(a,b[e].name.toLowerCase(),b[e].escaped),j.push(A(b[e],b,a,f));j.push((d&&f.keepClosingSlash?"/":"")+">")},end:function(a){if(v)return void j.push("</",a,">");f.collapseWhitespace&&(n.length&&a===n[n.length-1]&&n.pop(),o.length&&a===o[o.length-1]&&o.pop());var b=""===k&&a===l;return f.removeEmptyElements&&b&&w(a)?void j.splice(j.lastIndexOf("<")):void(f.removeOptionalTags&&u(a)||(j.push("</",a.toLowerCase(),">"),i.push.apply(i,j),j.length=0,k=""))},chars:function(a,d,e){return v?void j.push(a):(("script"===l||"style"===l)&&(f.removeCommentsFromCDATA&&(a=t(a,l)),f.removeCDATASectionsFromCDATA&&(a=r(a)),f.processScripts&&(a=s(a,f,m))),"script"===l&&f.minifyJS&&(a=C(a,f.minifyJS)),"style"===l&&f.minifyCSS&&(a=D(a,f.minifyCSS)),f.collapseWhitespace&&(n.length||(a=d||e?c(a,d,e,f):H(a)),o.length||(a=b(a))),k=a,p&&p.testChars(a),void j.push(a))},comment:function(a){return/^\s*htmlmin:ignore/.test(a)?(v=!v,void j.push("<!--"+a+"-->")):(a=f.removeComments?d(a)?"<!--"+q(a)+"-->":e(a,f)?"<!--"+a+"-->":"":"<!--"+a+"-->",void j.push(a))},ignore:function(a){j.push(f.removeIgnored?"":a)},doctype:function(a){j.push(f.useShortDoctype?"<!DOCTYPE html>":b(a))}}),i.push.apply(i,j);var I=i.join("");return F("minified in: "+(new Date-E)+"ms"),I}var F,G;F=a.console&&a.console.log?function(b){a.console.log(b)}:function(){},a.HTMLParser?G=a.HTMLParser:"function"==typeof require&&(G=require("./htmlparser").HTMLParser);var H=function(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")};String.prototype.trim&&(H=function(a){return a.trim()});var I={script:/^\s*(?:\/\/)?\s*<!--.*\n?/,style:/^\s*<!--\s*/},J={script:/\s*(?:\/\/)?\s*-->\s*$/,style:/\s*-->\s*$/},K=new RegExp("^(?:class|id|style|title|lang|dir|on(?:focus|blur|change|click|dblclick|mouse(?:down|up|over|move|out)|key(?:press|down|up)))$");"undefined"!=typeof exports?exports.minify=E:a.minify=E}(this),function(a){"use strict";function b(a){return/^(?:b|i|big|small|hr|blink|marquee)$/.test(a)}function c(a){return/^(?:applet|basefont|center|dir|font|isindex|s|strike|u)$/.test(a)}function d(a){return/^on[a-z]+/.test(a)}function e(a){return"style"===a.toLowerCase()}function f(a,b){return"align"===b&&/^(?:caption|applet|iframe|img|imput|object|legend|table|hr|div|h[1-6]|p)$/.test(a)||"alink"===b&&"body"===a||"alt"===b&&"applet"===a||"archive"===b&&"applet"===a||"background"===b&&"body"===a||"bgcolor"===b&&/^(?:table|t[rdh]|body)$/.test(a)||"border"===b&&/^(?:img|object)$/.test(a)||"clear"===b&&"br"===a||"code"===b&&"applet"===a||"codebase"===b&&"applet"===a||"color"===b&&/^(?:base(?:font)?)$/.test(a)||"compact"===b&&/^(?:dir|[dou]l|menu)$/.test(a)||"face"===b&&/^base(?:font)?$/.test(a)||"height"===b&&/^(?:t[dh]|applet)$/.test(a)||"hspace"===b&&/^(?:applet|img|object)$/.test(a)||"language"===b&&"script"===a||"link"===b&&"body"===a||"name"===b&&"applet"===a||"noshade"===b&&"hr"===a||"nowrap"===b&&/^t[dh]$/.test(a)||"object"===b&&"applet"===a||"prompt"===b&&"isindex"===a||"size"===b&&/^(?:hr|font|basefont)$/.test(a)||"start"===b&&"ol"===a||"text"===b&&"body"===a||"type"===b&&/^(?:li|ol|ul)$/.test(a)||"value"===b&&"li"===a||"version"===b&&"html"===a||"vlink"===b&&"body"===a||"vspace"===b&&/^(?:applet|img|object)$/.test(a)||"width"===b&&/^(?:hr|td|th|applet|pre)$/.test(a)}function g(a,b){return"href"===a&&/^\s*javascript\s*:\s*void\s*(\s+0|\(\s*0\s*\))\s*$/i.test(b)}function h(){this.log=[],this._lastElement=null,this._isElementRepeated=!1}h.prototype.testElement=function(a){c(a)?this.log.push('Found <span class="deprecated-element">deprecated</span> <strong><code>&lt;'+a+"&gt;</code></strong> element"):b(a)?this.log.push('Found <span class="presentational-element">presentational</span> <strong><code>&lt;'+a+"&gt;</code></strong> element"):this.checkRepeatingElement(a)},h.prototype.checkRepeatingElement=function(a){"br"===a&&"br"===this._lastElement?this._isElementRepeated=!0:this._isElementRepeated&&(this._reportRepeatingElement(),this._isElementRepeated=!1),this._lastElement=a},h.prototype._reportRepeatingElement=function(){this.log.push("Found <code>&lt;br></code> sequence. Try replacing it with styling.")},h.prototype.testAttribute=function(a,b,c){d(b)?this.log.push('Found <span class="event-attribute">event attribute</span> (<strong>'+b+"</strong>) on <strong><code>&lt;"+a+"&gt;</code></strong> element."):f(a,b)?this.log.push('Found <span class="deprecated-attribute">deprecated</span> <strong>'+b+"</strong> attribute on <strong><code>&lt;"+a+"&gt;</code></strong> element."):e(b)?this.log.push('Found <span class="style-attribute">style attribute</span> on <strong><code>&lt;'+a+"&gt;</code></strong> element."):g(b,c)&&this.log.push('Found <span class="inaccessible-attribute">inaccessible attribute</span> (on <strong><code>&lt;'+a+"&gt;</code></strong> element).")},h.prototype.testChars=function(a){this._lastElement="",/(&nbsp;\s*){2,}/.test(a)&&this.log.push("Found repeating <strong><code>&amp;nbsp;</code></strong> sequence. Try replacing it with styling.")},h.prototype.test=function(a,b,c){this.testElement(a),this.testAttribute(a,b,c)},h.prototype.populate=function(a){if(this._isElementRepeated&&this._reportRepeatingElement(),this.log.length)if(a)a.innerHTML="<ol><li>"+this.log.join("<li>")+"</ol>";else{var b=" - "+this.log.join("\n - ").replace(/(<([^>]+)>)/gi,"").replace(/&lt;/g,"<").replace(/&gt;/g,">");console.log(b)}},a.HTMLLint=h}("undefined"==typeof exports?this:exports);
{
"name": "html-minifier",
"description": "HTML minifier with lint-like capabilities.",
"version": "0.5.6",
"version": "0.6.0",
"keywords": [

@@ -10,3 +10,2 @@ "html",

],
"url": "http://github.com/kangax/html-minifier",
"homepage": "http://kangax.github.io/html-minifier/",

@@ -27,3 +26,3 @@ "author": "Juriy \"kangax\" Zaytsev",

"type": "git",
"url": "git://github.com/kangax/html-minifier"
"url": "https://github.com/kangax/html-minifier"
},

@@ -34,3 +33,3 @@ "bugs": {

"engines": {
"node": ">=0.8.0"
"node": ">=0.10.0"
},

@@ -43,16 +42,21 @@ "directories": {

},
"dependencies": {
"clean-css": "2.1.x",
"uglify-js": "2.4.x"
},
"devDependencies": {
"grunt": "0.4.x",
"grunt-contrib-concat": "0.3.x",
"grunt-contrib-jshint": "0.8.x",
"grunt-contrib-concat": "0.4.x",
"grunt-contrib-jshint": "0.10.x",
"grunt-contrib-qunit": "0.4.x",
"grunt-contrib-uglify": "0.3.x",
"grunt-contrib-uglify": "0.4.x",
"grunt-exec": "0.4.x",
"grunt-jscs-checker": "0.4.x",
"load-grunt-tasks": "0.3.x",
"qunit": "0.5.x",
"time-grunt": "0.2.x"
"load-grunt-tasks": "0.4.x",
"qunit": "0.6.x",
"time-grunt": "0.3.x"
},
"files": [
"dist",
"CHANGELOG.md",
"LICENSE"

@@ -59,0 +63,0 @@ ],

@@ -1,4 +0,5 @@

[![NPM version](https://badge.fury.io/js/html-minifier.png)](http://badge.fury.io/js/html-minifier)
[![Build Status](https://travis-ci.org/kangax/html-minifier.png)](https://travis-ci.org/kangax/html-minifier)
[![devDependency Status](https://david-dm.org/kangax/html-minifier/dev-status.png?theme=shields.io)](https://david-dm.org/kangax/html-minifier#info=devDependencies)
[![NPM version](https://badge.fury.io/js/html-minifier.svg)](http://badge.fury.io/js/html-minifier)
[![Build Status](https://travis-ci.org/kangax/html-minifier.svg)](https://travis-ci.org/kangax/html-minifier)
[![Dependency Status](https://david-dm.org/kangax/html-minifier.svg?theme=shields.io)](https://david-dm.org/kangax/html-minifier)
[![devDependency Status](https://david-dm.org/kangax/html-minifier/dev-status.svg?theme=shields.io)](https://david-dm.org/kangax/html-minifier#info=devDependencies)

@@ -11,13 +12,15 @@ [HTMLMinifier](http://kangax.github.io/html-minifier/) is a highly __configurable__, __well-tested__, Javascript-based HTML minifier, with lint-like capabilities.

Also see corresponding [Grunt plugin](https://github.com/gruntjs/grunt-contrib-htmlmin).
Also see corresponding [Grunt plugin](https://github.com/gruntjs/grunt-contrib-htmlmin) & [Ruby wrapper](https://github.com/stereobooster/html_minifier).
How does HTMLMinifier compare to [another solution](http://www.willpeavy.com/minifier/) — HTML Minifier from Will Peavy (1st result in [google search for "html minifier"](https://www.google.com/#q=html+minifier))?
| Site | Original size _(KB)_ | HTMLMinifier _(KB)_ | Will Peavy _(KB)_ |
| ------------- |:-------------:| -------------:| -----------:|
| [Wikipedia](http://en.wikipedia.org/wiki/President_of_the_United_States) | 401.4 | <b>385.5</b> | 396.3 |
| [Stackoverflow](http://stackoverflow.com) | 200.4 | <b>165.3</b> | 168.3 |
| [Amazon](http://amazon.com) | 245.9 | 237.1 | <b>225</b> |
| [ES6 table](http://kangax.github.io/es5-compat-table/es6/) | 117.9 | <b>82</b> | 92 |
| [HTMLMinifier page](https://github.com/kangax/html-minifier) | 48.8 | <b>41.3</b> | 43.3 |
| Site | Original size _(KB)_ | HTMLMinifier _(KB)_ | Will Peavy _(KB)_ |
| --------------------------------------------------------------------------- |:-----------:| ----------------:| ------------:|
| [Wikipedia](http://en.wikipedia.org/wiki/President_of_the_United_States) | 401.4 | <b>385.5</b> | 396.3 |
| [Stackoverflow](http://stackoverflow.com) | 200.4 | <b>165.3</b> | 168.3 |
| [MSN](http://msn.com) | 160 | <b>141</b> | 145 |
| [Amazon](http://amazon.com) | 245.9 | 237.1 | <b>225</b> |
| [ES6 table](http://kangax.github.io/es5-compat-table/es6/) | 117.9 | <b>82</b> | 92 |
| [HTMLMinifier page](https://github.com/kangax/html-minifier) | 48.8 | <b>41.3</b> | 43.3 |
| [Eloquent Javascript](http://eloquentjavascript.net/print.html) | 890 | <b>860</b> | 872 |

@@ -34,18 +37,27 @@

| Option | Description | Default |
|--------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| `removeComments` | [Strip HTML comments](http://perfectionkills.com/experimenting-with-html-minifier/#remove_comments) | `false` |
| `removeCommentsFromCDATA` | [Strip HTML comments from scripts and styles](http://perfectionkills.com/experimenting-with-html-minifier/#remove_comments_from_scripts_and_styles) | `false` |
| `removeCDATASectionsFromCDATA` | [Remove CDATA sections from script and style elements](http://perfectionkills.com/experimenting-with-html-minifier/#remove_cdata_sections) | `false` |
| Option | Description | Default |
|--------------------------------|-----------------|---------|
| `removeComments` | [Strip HTML comments](http://perfectionkills.com/experimenting-with-html-minifier/#remove_comments) | `false` |
| `removeCommentsFromCDATA` | [Strip HTML comments from scripts and styles](http://perfectionkills.com/experimenting-with-html-minifier/#remove_comments_from_scripts_and_styles) | `false` |
| `removeCDATASectionsFromCDATA` | [Remove CDATA sections from script and style elements](http://perfectionkills.com/experimenting-with-html-minifier/#remove_cdata_sections) | `false` |
| `collapseWhitespace` | [Collapse white space that contributes to text nodes in a document tree.](http://perfectionkills.com/experimenting-with-html-minifier/#collapse_whitespace) | `false` |
| `collapseBooleanAttributes` | [Omit attribute values from boolean attributes](http://perfectionkills.com/experimenting-with-html-minifier/#collapse_boolean_attributes) | `false` |
| `removeAttributeQuotes` | [Remove quotes around attributes when possible.](http://perfectionkills.com/experimenting-with-html-minifier/#remove_attribute_quotes) | `false` |
| `removeRedundantAttributes` | [Remove attributes when value matches default.](http://perfectionkills.com/experimenting-with-html-minifier/#remove_redundant_attributes) | `false` |
| `useShortDoctype` | [Replaces the doctype with the short (HTML5) doctype](http://perfectionkills.com/experimenting-with-html-minifier/#use_short_doctype) | `false` |
| `removeEmptyAttributes` | [Remove all attributes with whitespace-only values](http://perfectionkills.com/experimenting-with-html-minifier/#remove_empty_or_blank_attributes) | `false` |
| `removeOptionalTags` | [Remove unrequired tags](http://perfectionkills.com/experimenting-with-html-minifier/#remove_optional_tags) | `false` |
| `removeEmptyElements` | [Remove all elements with empty contents](http://perfectionkills.com/experimenting-with-html-minifier/#remove_empty_elements) | `false` |
| `lint` | [Toggle linting](http://perfectionkills.com/experimenting-with-html-minifier/#validate_input_through_html_lint) | `false` |
| `conservativeCollapse` | Always collapse to 1 space (never remove it entirely) | `false` |
| `collapseBooleanAttributes` | [Omit attribute values from boolean attributes](http://perfectionkills.com/experimenting-with-html-minifier/#collapse_boolean_attributes) | `false` |
| `removeAttributeQuotes` | [Remove quotes around attributes when possible.](http://perfectionkills.com/experimenting-with-html-minifier/#remove_attribute_quotes) | `false` |
| `removeRedundantAttributes` | [Remove attributes when value matches default.](http://perfectionkills.com/experimenting-with-html-minifier/#remove_redundant_attributes) | `false` |
| `useShortDoctype` | [Replaces the doctype with the short (HTML5) doctype](http://perfectionkills.com/experimenting-with-html-minifier/#use_short_doctype) | `false` |
| `removeEmptyAttributes` | [Remove all attributes with whitespace-only values](http://perfectionkills.com/experimenting-with-html-minifier/#remove_empty_or_blank_attributes) | `false` |
| `removeOptionalTags` | [Remove unrequired tags](http://perfectionkills.com/experimenting-with-html-minifier/#remove_optional_tags) | `false` |
| `removeEmptyElements` | [Remove all elements with empty contents](http://perfectionkills.com/experimenting-with-html-minifier/#remove_empty_elements) | `false` |
| `lint` | [Toggle linting](http://perfectionkills.com/experimenting-with-html-minifier/#validate_input_through_html_lint) | `false` |
| `keepClosingSlash` | Keep the trailing slash on singleton elements | `false` |
| `caseSensitive` | Treat attributes in case sensitive manner (useful for SVG; e.g. viewBox) | `false` |
| `minifyJS` | Minify Javascript in script elements and on* attributes (uses [UglifyJS](https://github.com/mishoo/UglifyJS2)) | `false` (could be `true`, `false`, `Object` (options)) |
| `minifyCSS` | Minify CSS in style elements and style attributes (uses [clean-css](https://github.com/GoalSmashers/clean-css)) | `false` (could be `true`, `false`, `Object` (options)) |
| `ignoreCustomComments` | Array of regex'es that allow to ignore certain comments, when matched | `[ ]` |
| `processScripts` | Array of strings corresponding to types of script elements to process through minifier (e.g. "text/ng-template", "text/x-handlebars-template", etc.) | `[ ]` |
Chunks of markup can be ignored by wrapping them with `<!-- htmlmin:ignore -->`.
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/kangax/html-minifier/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc