From: Juriy Zaytsev Date: Fri, 5 Feb 2010 23:32:41 +0000 (-0500) Subject: Add todo section; X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=bcd51a4c8e27abbef9365963b160783dfc91800f;p=html-minifier.git Add todo section; Add warning about draft state of minifier; Rearrange UI slightly; Whitepaces are now collapsed to 0 characters by default (instead of 1); Make sure tags and attribute names match in a case-insensitive manner. --- diff --git a/index.html b/index.html index 726219f..e506f77 100644 --- a/index.html +++ b/index.html @@ -63,13 +63,27 @@ -

+

+

+ Minifier is very draft and is not yet thoroughly tested. Use at your own risk. +

+
+ TODO: + +

- Minifier is made by kangax, + Minifier is made by kangax, using tweaked version of HTML parser by John Resig (which, in its turn, is based on work of Erik Arvidsson).

diff --git a/master.css b/master.css index bd5bfc9..ee4402e 100644 --- a/master.css +++ b/master.css @@ -1,15 +1,19 @@ body { font-family: "Cambria", Georgia, Times, "Times New Roman", serif; } textarea { height: 20em; } h1 { margin-top: 0.5em; font-size: 1.25em; } +button { font-weight: bold; width: 100px; } #wrapper { overflow: hidden; min-width: 900px; } -#input { width: 65%; margin-bottom: 1em; } -#output { width: 100%; height: 18em; } +#input { width: 65%; } +#output { width: 100%; height: 18em; margin-bottom: 2em; } #options { float: right; width: 33%; padding-left: 1em; } #options ul { list-style: none; padding: 0.5em; overflow: hidden; background: #ffe; margin-top: 0; } #options ul li { float: left; clear: both; padding-bottom: 0.5em; } #options label, #options input { float: left; } #options input { margin-right: 0.5em; } +#stats { margin-bottom: 2em; } +#todo { font-family: monospace; } +#warning { background: #fcc; padding: 0.25em; display: inline-block; } .success { color: green; } .failure { color: red; } diff --git a/master.js b/master.js index 64f9123..3948cd2 100644 --- a/master.js +++ b/master.js @@ -29,7 +29,7 @@ return String(str).replace(/&/g, '&').replace(//g, '>'); } function collapseWhitespace(str) { - return str.replace(/^\s+/, ' ').replace(/\s+$/, ' '); + return str.replace(/^\s+/, '').replace(/\s+$/, ''); } function canRemoveAttributeQuotes(value) { // http://www.w3.org/TR/html4/intro/sgmltut.html#attributes @@ -38,16 +38,16 @@ } function isAttributeRedundant(tag, attributeName, attributeValue) { return ( - (tag === 'script' && - attributeName === 'language' && + (/^script$/i.test(tag) && + /^language$/i.test(attributeName) && /^javascript$/i.test(attributeValue)) || - (tag === 'form' && - attributeName === 'method' && + (/^form$/i.test(tag) && + /^method$/i.test(attributeName) && /^get$/i.test(attributeValue)) || - (tag === 'input' && - attributeName === 'type' && + (/^input$/i.test(tag) && + /^type$/i.test(attributeName) && /^text$/i.test(attributeValue)) ); }