From: kangax Date: Fri, 11 Jul 2014 11:35:40 +0000 (+0200) Subject: Update quint, build dist X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=e2e4ff5b841e2e86cd4faf3dc53ca8005f7147bd;p=html-minifier.git Update quint, build dist --- diff --git a/dist/htmlminifier.js b/dist/htmlminifier.js index e515cc0..95a7e86 100644 --- a/dist/htmlminifier.js +++ b/dist/htmlminifier.js @@ -685,7 +685,7 @@ } function cleanAttributeValue(tag, attrName, attrValue, options, attrs) { - if (isEventAttribute(attrName)) { + if (attrValue && isEventAttribute(attrName)) { attrValue = trimWhitespace(attrValue).replace(/^javascript:\s*/i, '').replace(/\s*;$/, ''); if (options.minifyJS) { var wrappedCode = '(function(){' + attrValue + '})()'; diff --git a/dist/htmlminifier.min.js b/dist/htmlminifier.min.js index aaf17a3..48c5b28 100644 --- a/dist/htmlminifier.min.js +++ b/dist/htmlminifier.min.js @@ -3,4 +3,4 @@ * 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){var b;if(a.customAttrSurround){for(var c=[],d=a.customAttrSurround.length-1;d>=0;d--)c[d]="(?:\\s*"+a.customAttrSurround[d][0].source+i.source+a.customAttrSurround[d][1].source+")";c.unshift(i.source),b=new RegExp("((?:"+c.join("|")+")*)")}else b=new RegExp("("+i.source+")");return new RegExp(h.source+b.source+j.source)}function c(a){if(a.customAttrSurround){for(var b=[],c=a.customAttrSurround.length-1;c>=0;c--)b[c]="(?:("+a.customAttrSurround[c][0].source+")"+m.source+"("+a.customAttrSurround[c][1].source+"))";return b.unshift("(?:"+m.source+")"),new RegExp(b.join("|"),"g")}return new RegExp(m.source,"g")}function d(a){for(var b={},c=a.split(","),d=0;d\s]+))?)*/,j=/\s*(\/?)>/,k=/^<\/([\w:-]+)[^>]*>/,l=/\/>$/,m=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/,n=/^]+>/i,o=/<(%|\?)/,p=/(%|\?)>/,q=d("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,wbr"),r=d("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,noscript,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,svg,textarea,tt,u,var"),s=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),t=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),u=d("script,style,noscript"),v={},w=a.HTMLParser=function(a,d){function h(a,b,c,e){for(var f=!1;!d.html5&&z.last()&&r[z.last()];)i("",z.last());if(s[b]&&z.last()===b&&i("",b),e=q[b]||!!e,e?f=a.match(l):z.push(b),d.start){var g=[];c.replace(C,function(){var a,b,c,e,f;if(a=arguments[1])c=arguments[2],b=c||arguments[3]||arguments[4];else if(d.customAttrSurround)for(var h=d.customAttrSurround.length-1;h>=0;h--)if(a=arguments[6*h+6]){c=arguments[6*h+7],b=c||arguments[6*h+8]||arguments[6*h+9],e=arguments[6*h+5],f=arguments[6*h+10];break}void 0===b&&(b=t[a]?a:c),g.push({name:a,value:b,escaped:b&&b.replace(/(^|[^\\])"/g,"$1""),customOpen:e||"",customClose:f||""})}),d.start&&d.start(b,g,e,f)}}function i(a,b){var c;if(b)for(c=z.length-1;c>=0&&z[c].toLowerCase()!==b;c--);else c=0;if(c>=0){for(var e=z.length-1;e>=c;e--)d.end&&d.end(z[e]);z.length=c}}var j,m,w,x,y,z=[],A=a;z.last=function(){return this[this.length-1]};for(var B=b(d),C=c(d);a;){if(m=!0,z.last()&&u[z.last()])e=z.last().toLowerCase(),f=v[e]||(v[e]=new RegExp("([\\s\\S]*?)]*>","i")),a=a.replace(f,function(a,b){return"script"!==e&&"style"!==e&&"noscript"!==e&&(b=b.replace(//g,"$1").replace(//g,"$1")),d.chars&&d.chars(b),""}),i("",e);else if(0===a.indexOf(""),j>=0&&(d.comment&&d.comment(a.substring(4,j)),a=a.substring(j+3),m=!1)),0===a.indexOf(""),j>=0&&(d.comment&&d.comment(a.substring(2,j+1),!0),a=a.substring(j+2),m=!1)):0===a.search(o)?(j=a.search(p),j>=0&&(d.ignore&&d.ignore(a.substring(0,j+2)),a=a.substring(j+2),m=!1)):(w=n.exec(a))?(d.doctype&&d.doctype(w[0]),a=a.substring(w[0].length),m=!1):0===a.indexOf("j?a:a.substring(0,j);a=0>j?"":a.substring(j),g=a.match(B),g?y=g[1]:(g=a.match(k),y=g?"/"+g[1]:""),d.chars&&d.chars(D,x,y)}if(a===A)throw"Parse Error: "+a;A=a}i()};a.HTMLtoXML=function(a){var b="";return new w(a,{start:function(a,c,d){b+="<"+a;for(var e=0;e"},end:function(a){b+=""},chars:function(a){b+=a},comment:function(a){b+=""},ignore:function(a){b+=a}}),b},a.HTMLtoDOM=function(a,b){var c=d("html,head,body,title"),e={link:"head",base:"head"};b?b=b.ownerDocument||b.getOwnerDocument&&b.getOwnerDocument()||b:"undefined"!=typeof DOMDocument?b=new DOMDocument:"undefined"!=typeof document&&document.implementation&&document.implementation.createDocument?b=document.implementation.createDocument("","",null):"undefined"!=typeof ActiveX&&(b=new ActiveXObject("Msxml.DOMDocument"));var f=[],g=b.documentElement||b.getDocumentElement&&b.getDocumentElement();if(!g&&b.createElement&&!function(){var a=b.createElement("html"),c=b.createElement("head");c.appendChild(b.createElement("title")),a.appendChild(c),a.appendChild(b.createElement("body")),b.appendChild(a)}(),b.getElementsByTagName)for(var h in c)c[h]=b.getElementsByTagName(h)[0];var i=c.body;return new w(a,{start:function(a,d,g){if(c[a])return void(i=c[a]);var h=b.createElement(a);for(var j in d)h.setAttribute(d[j].name,d[j].value);e[a]&&"boolean"!=typeof c[e[a]]?c[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(b.createTextNode(a))},comment:function(){},ignore:function(){}}),b}}("undefined"==typeof exports?this:exports),function(a){"use strict";function b(a){return a?a.replace(/[\t\n\r ]+/g," "):a}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","svg","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*((?: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|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,""")}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*(\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);return a}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," "+a.customOpen+e+a.customClose))}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=f.caseSensitive?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("");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(""),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,b){var c=b?"":"-->";return/^\s*htmlmin:ignore/.test(a)?(v=!v,void j.push("")):(a=f.removeComments?d(a)?c+q(a)+g:e(a,f)?"":"":c+a+g,void j.push(a))},ignore:function(a){j.push(f.removeIgnored?"":a)},doctype:function(a){j.push(f.useShortDoctype?"":b(a))},customAttrSurround:f.customAttrSurround}),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"string"!=typeof a?a:a.replace(/^\s+/,"").replace(/\s+$/,"")};String.prototype.trim&&(H=function(a){return"string"!=typeof a?a:a.trim()});var I={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 deprecated <'+a+"> element"):b(a)?this.log.push('Found presentational <'+a+"> 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 <br> sequence. Try replacing it with styling.")},h.prototype.testAttribute=function(a,b,c){d(b)?this.log.push('Found event attribute ('+b+") on <"+a+"> element."):f(a,b)?this.log.push('Found deprecated '+b+" attribute on <"+a+"> element."):e(b)?this.log.push('Found style attribute on <'+a+"> element."):g(b,c)&&this.log.push('Found inaccessible attribute (on <'+a+"> element).")},h.prototype.testChars=function(a){this._lastElement="",/( \s*){2,}/.test(a)&&this.log.push("Found repeating &nbsp; 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="
  1. "+this.log.join("
  2. ")+"
";else{var b=" - "+this.log.join("\n - ").replace(/(<([^>]+)>)/gi,"").replace(/</g,"<").replace(/>/g,">");console.log(b)}},a.HTMLLint=h}("undefined"==typeof exports?this:exports); \ No newline at end of file +!function(a){"use strict";function b(a){var b;if(a.customAttrSurround){for(var c=[],d=a.customAttrSurround.length-1;d>=0;d--)c[d]="(?:\\s*"+a.customAttrSurround[d][0].source+i.source+a.customAttrSurround[d][1].source+")";c.unshift(i.source),b=new RegExp("((?:"+c.join("|")+")*)")}else b=new RegExp("("+i.source+")");return new RegExp(h.source+b.source+j.source)}function c(a){if(a.customAttrSurround){for(var b=[],c=a.customAttrSurround.length-1;c>=0;c--)b[c]="(?:("+a.customAttrSurround[c][0].source+")"+m.source+"("+a.customAttrSurround[c][1].source+"))";return b.unshift("(?:"+m.source+")"),new RegExp(b.join("|"),"g")}return new RegExp(m.source,"g")}function d(a){for(var b={},c=a.split(","),d=0;d\s]+))?)*/,j=/\s*(\/?)>/,k=/^<\/([\w:-]+)[^>]*>/,l=/\/>$/,m=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/,n=/^]+>/i,o=/<(%|\?)/,p=/(%|\?)>/,q=d("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,wbr"),r=d("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,noscript,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,svg,textarea,tt,u,var"),s=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),t=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),u=d("script,style,noscript"),v={},w=a.HTMLParser=function(a,d){function h(a,b,c,e){for(var f=!1;!d.html5&&z.last()&&r[z.last()];)i("",z.last());if(s[b]&&z.last()===b&&i("",b),e=q[b]||!!e,e?f=a.match(l):z.push(b),d.start){var g=[];c.replace(C,function(){var a,b,c,e,f;if(a=arguments[1])c=arguments[2],b=c||arguments[3]||arguments[4];else if(d.customAttrSurround)for(var h=d.customAttrSurround.length-1;h>=0;h--)if(a=arguments[6*h+6]){c=arguments[6*h+7],b=c||arguments[6*h+8]||arguments[6*h+9],e=arguments[6*h+5],f=arguments[6*h+10];break}void 0===b&&(b=t[a]?a:c),g.push({name:a,value:b,escaped:b&&b.replace(/(^|[^\\])"/g,"$1""),customOpen:e||"",customClose:f||""})}),d.start&&d.start(b,g,e,f)}}function i(a,b){var c;if(b)for(c=z.length-1;c>=0&&z[c].toLowerCase()!==b;c--);else c=0;if(c>=0){for(var e=z.length-1;e>=c;e--)d.end&&d.end(z[e]);z.length=c}}var j,m,w,x,y,z=[],A=a;z.last=function(){return this[this.length-1]};for(var B=b(d),C=c(d);a;){if(m=!0,z.last()&&u[z.last()])e=z.last().toLowerCase(),f=v[e]||(v[e]=new RegExp("([\\s\\S]*?)]*>","i")),a=a.replace(f,function(a,b){return"script"!==e&&"style"!==e&&"noscript"!==e&&(b=b.replace(//g,"$1").replace(//g,"$1")),d.chars&&d.chars(b),""}),i("",e);else if(0===a.indexOf(""),j>=0&&(d.comment&&d.comment(a.substring(4,j)),a=a.substring(j+3),m=!1)),0===a.indexOf(""),j>=0&&(d.comment&&d.comment(a.substring(2,j+1),!0),a=a.substring(j+2),m=!1)):0===a.search(o)?(j=a.search(p),j>=0&&(d.ignore&&d.ignore(a.substring(0,j+2)),a=a.substring(j+2),m=!1)):(w=n.exec(a))?(d.doctype&&d.doctype(w[0]),a=a.substring(w[0].length),m=!1):0===a.indexOf("j?a:a.substring(0,j);a=0>j?"":a.substring(j),g=a.match(B),g?y=g[1]:(g=a.match(k),y=g?"/"+g[1]:""),d.chars&&d.chars(D,x,y)}if(a===A)throw"Parse Error: "+a;A=a}i()};a.HTMLtoXML=function(a){var b="";return new w(a,{start:function(a,c,d){b+="<"+a;for(var e=0;e"},end:function(a){b+=""},chars:function(a){b+=a},comment:function(a){b+=""},ignore:function(a){b+=a}}),b},a.HTMLtoDOM=function(a,b){var c=d("html,head,body,title"),e={link:"head",base:"head"};b?b=b.ownerDocument||b.getOwnerDocument&&b.getOwnerDocument()||b:"undefined"!=typeof DOMDocument?b=new DOMDocument:"undefined"!=typeof document&&document.implementation&&document.implementation.createDocument?b=document.implementation.createDocument("","",null):"undefined"!=typeof ActiveX&&(b=new ActiveXObject("Msxml.DOMDocument"));var f=[],g=b.documentElement||b.getDocumentElement&&b.getDocumentElement();if(!g&&b.createElement&&!function(){var a=b.createElement("html"),c=b.createElement("head");c.appendChild(b.createElement("title")),a.appendChild(c),a.appendChild(b.createElement("body")),b.appendChild(a)}(),b.getElementsByTagName)for(var h in c)c[h]=b.getElementsByTagName(h)[0];var i=c.body;return new w(a,{start:function(a,d,g){if(c[a])return void(i=c[a]);var h=b.createElement(a);for(var j in d)h.setAttribute(d[j].name,d[j].value);e[a]&&"boolean"!=typeof c[e[a]]?c[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(b.createTextNode(a))},comment:function(){},ignore:function(){}}),b}}("undefined"==typeof exports?this:exports),function(a){"use strict";function b(a){return a?a.replace(/[\t\n\r ]+/g," "):a}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","svg","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*((?: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|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(d&&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,""")}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*(\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);return a}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," "+a.customOpen+e+a.customClose))}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=f.caseSensitive?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("");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(""),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,b){var c=b?"":"-->";return/^\s*htmlmin:ignore/.test(a)?(v=!v,void j.push("")):(a=f.removeComments?d(a)?c+q(a)+g:e(a,f)?"":"":c+a+g,void j.push(a))},ignore:function(a){j.push(f.removeIgnored?"":a)},doctype:function(a){j.push(f.useShortDoctype?"":b(a))},customAttrSurround:f.customAttrSurround}),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"string"!=typeof a?a:a.replace(/^\s+/,"").replace(/\s+$/,"")};String.prototype.trim&&(H=function(a){return"string"!=typeof a?a:a.trim()});var I={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 deprecated <'+a+"> element"):b(a)?this.log.push('Found presentational <'+a+"> 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 <br> sequence. Try replacing it with styling.")},h.prototype.testAttribute=function(a,b,c){d(b)?this.log.push('Found event attribute ('+b+") on <"+a+"> element."):f(a,b)?this.log.push('Found deprecated '+b+" attribute on <"+a+"> element."):e(b)?this.log.push('Found style attribute on <'+a+"> element."):g(b,c)&&this.log.push('Found inaccessible attribute (on <'+a+"> element).")},h.prototype.testChars=function(a){this._lastElement="",/( \s*){2,}/.test(a)&&this.log.push("Found repeating &nbsp; 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="
  1. "+this.log.join("
  2. ")+"
";else{var b=" - "+this.log.join("\n - ").replace(/(<([^>]+)>)/gi,"").replace(/</g,"<").replace(/>/g,">");console.log(b)}},a.HTMLLint=h}("undefined"==typeof exports?this:exports); \ No newline at end of file diff --git a/package.json b/package.json index b07e1da..7008365 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "grunt-exec": "0.4.x", "grunt-jscs": "0.6.x", "load-grunt-tasks": "0.6.x", - "qunit": "0.6.x", + "qunit": "0.7.x", "time-grunt": "0.3.x", "underscore": "1.6.x" },