Comparing version 0.15.0 to 0.15.1
@@ -0,1 +1,8 @@ | ||
## [0.15.1](https://github.com/htmlhint/HTMLHint/compare/v0.15.0...v0.15.1) (2021-06-11) | ||
### Bug Fixes | ||
* Unexpected behavior of the html lang require rule ([#655](https://github.com/htmlhint/HTMLHint/issues/655)) ([068645e](https://github.com/htmlhint/HTMLHint/commit/068645e9111f42adfa0fae0e32e236d88052541c)) | ||
# [0.15.0](https://github.com/htmlhint/HTMLHint/compare/v0.14.2...v0.15.0) (2021-06-10) | ||
@@ -2,0 +9,0 @@ |
@@ -22,3 +22,2 @@ "use strict"; | ||
var languageTag = "(" + grandfathered + "|" + langtag + "|" + privateUse2 + ")"; | ||
var LANG_VALIDITY_PATTERN = new RegExp(languageTag, 'g'); | ||
exports.default = { | ||
@@ -33,16 +32,19 @@ id: 'html-lang-require', | ||
var col = event.col + tagName.length + 1; | ||
if (tagName === 'html' && 'lang' in mapAttrs) { | ||
if (!mapAttrs['lang']) { | ||
reporter.warn('The lang attribute of <html> element must have a value.', event.line, col, _this, event.raw); | ||
var langValidityPattern = new RegExp(languageTag, 'g'); | ||
if (tagName === 'html') { | ||
if ('lang' in mapAttrs) { | ||
if (!mapAttrs['lang']) { | ||
reporter.warn('The lang attribute of <html> element must have a value.', event.line, col, _this, event.raw); | ||
} | ||
else if (!langValidityPattern.test(mapAttrs['lang'])) { | ||
reporter.warn('The lang attribute value of <html> element must be a valid BCP47.', event.line, col, _this, event.raw); | ||
} | ||
} | ||
else if (!LANG_VALIDITY_PATTERN.test(mapAttrs['lang'])) { | ||
reporter.warn('The lang attribute value of <html> element must be a valid BCP47.', event.line, col, _this, event.raw); | ||
else { | ||
reporter.warn('An lang attribute must be present on <html> elements.', event.line, col, _this, event.raw); | ||
} | ||
} | ||
else { | ||
reporter.warn('An lang attribute must be present on <html> elements.', event.line, col, _this, event.raw); | ||
} | ||
}); | ||
}, | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxl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BQ0osS0FBSyxDQUFDLEdBQUcsQ0FDVixDQUFBO3FCQUNGO3lCQUFNLElBQUksQ0FBQyxtQkFBbUIsQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxDQUFDLEVBQUU7d0JBQ3RELFFBQVEsQ0FBQyxJQUFJLENBQ1gsbUVBQW1FLEVBQ25FLEtBQUssQ0FBQyxJQUFJLEVBQ1YsR0FBRyxFQUNILEtBQUksRUFDSixLQUFLLENBQUMsR0FBRyxDQUNWLENBQUE7cUJBQ0Y7aUJBQ0Y7cUJBQU07b0JBQ0wsUUFBUSxDQUFDLElBQUksQ0FDWCx1REFBdUQsRUFDdkQsS0FBSyxDQUFDLElBQUksRUFDVixHQUFHLEVBQ0gsS0FBSSxFQUNKLEtBQUssQ0FBQyxHQUFHLENBQ1YsQ0FBQTtpQkFDRjthQUNGO1FBQ0gsQ0FBQyxDQUFDLENBQUE7SUFDSixDQUFDO0NBQ00sQ0FBQSJ9 |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).HTMLHint=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var a=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this._listeners={},this._mapCdataTags=this.makeMap("script,style"),this._arrBlocks=[],this.lastEvent=null}return e.prototype.makeMap=function(e){for(var t={},n=e.split(","),a=0;a<n.length;a++)t[n[a]]=!0;return t},e.prototype.parse=function(e){var t,n,a,r,i,o,s=this,l=this._mapCdataTags,u=/<(?:\/([^\s>]+)\s*|!--([\s\S]*?)--|!([^>]*?)|([\w\-:]+)((?:\s+[^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]*))?)*?)\s*(\/?))>/g,d=/\s*([^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+)(?:\s*=\s*(?:(")([^"]*)"|(')([^']*)'|([^\s"'>]*)))?/g,c=/\r?\n/g,f=0,p=null,g=[],h=0,m=0,v=1,b=this._arrBlocks;this.fire("start",{pos:0,line:1,col:1});for(var y,w=function(e,t,n,a){var r=n-m+1;for(void 0===a&&(a={}),a.raw=t,a.pos=n,a.line=v,a.col=r,b.push(a),s.fire(e,a);c.exec(t);)v++,m=n+c.lastIndex};t=u.exec(e);)if((n=t.index)>f&&(o=e.substring(f,n),p?g.push(o):w("text",o,f)),f=u.lastIndex,!(a=t[1])||(p&&a===p&&(w("cdata",o=g.join(""),h,{tagName:p,attrs:i}),p=null,i=void 0,g=[]),p))if(p)g.push(t[0]);else if(a=t[4]){r=[];for(var O=t[5],x=void 0,_=0;x=d.exec(O);){var j=x[1],L=x[2]?x[2]:x[4]?x[4]:"",P=x[3]?x[3]:x[5]?x[5]:x[6]?x[6]:"";r.push({name:j,value:P,quote:L,index:x.index,raw:x[0]}),_+=x[0].length}_===O.length?(w("tagstart",t[0],n,{tagName:a,attrs:r,close:t[6]}),y=void 0,y=r.find((function(e){return"type"===e.name}))||{value:""},l[a]&&-1===y.value.indexOf("text/ng-template")&&(p=a,i=r.concat(),g=[],h=f)):w("text",t[0],n)}else(t[2]||t[3])&&w("comment",t[0],n,{content:t[2]||t[3],long:!!t[2]});else w("tagend",t[0],n,{tagName:a});e.length>f&&w("text",o=e.substring(f,e.length),f),this.fire("end",{pos:f,line:v,col:e.length-m+1})},e.prototype.addListener=function(e,t){for(var n,a=this._listeners,r=e.split(/[,\s]/),i=0,o=r.length;i<o;i++)void 0===a[n=r[i]]&&(a[n]=[]),a[n].push(t)},e.prototype.fire=function(e,t){void 0===t&&(t={}),t.type=e;var n=[],a=this._listeners[e],r=this._listeners.all;void 0!==a&&(n=n.concat(a)),void 0!==r&&(n=n.concat(r));var i=this.lastEvent;null!==i&&(delete i.lastEvent,t.lastEvent=i),this.lastEvent=t;for(var o=0,s=n.length;o<s;o++)n[o].call(this,t)},e.prototype.removeListener=function(e,t){var n=this._listeners[e];if(void 0!==n)for(var a=0,r=n.length;a<r;a++)if(n[a]===t){n.splice(a,1);break}},e.prototype.fixPos=function(e,t){var n,a=e.raw.substr(0,t).split(/\r?\n/),r=a.length-1,i=e.line;return r>0?(i+=r,n=a[r].length+1):n=e.col+t,{line:i,col:n}},e.prototype.getMapAttrs=function(e){for(var t,n={},a=0,r=e.length;a<r;a++)n[(t=e[a]).name]=t.value;return n},e}();t.default=n})),r=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this.html=e,this.lines=e.split(/\r?\n/);var n=/\r?\n/.exec(e);this.brLen=null!==n?n[0].length:0,this.ruleset=t,this.messages=[]}return e.prototype.info=function(e,t,n,a,r){this.report("info",e,t,n,a,r)},e.prototype.warn=function(e,t,n,a,r){this.report("warning",e,t,n,a,r)},e.prototype.error=function(e,t,n,a,r){this.report("error",e,t,n,a,r)},e.prototype.report=function(e,t,n,a,r,i){for(var o=this.lines,s=this.brLen,l="",u=0,d=n-1,c=o.length;d<c&&(a>(u=(l=o[d]).length)&&n<c);d++)n++,1!==(a-=u)&&(a-=s);this.messages.push({type:e,message:t,raw:i,evidence:l,line:n,col:a,rule:{id:r.id,description:r.description,link:"https://github.com/thedaviddias/HTMLHint/wiki/"+r.id}})},e}();t.default=n})),i=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"alt-require",description:"The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",init:function(e,t){var n=this;e.addListener("tagstart",(function(a){var r,i=a.tagName.toLowerCase(),o=e.getMapAttrs(a.attrs),s=a.col+i.length+1;"img"!==i||"alt"in o?("area"===i&&"href"in o||"input"===i&&"image"===o.type)&&("alt"in o&&""!==o.alt||(r="area"===i?"area[href]":"input[type=image]",t.warn("The alt attribute of "+r+" must have a value.",a.line,s,n,a.raw))):t.warn("An alt attribute must be present on <img> elements.",a.line,s,n,a.raw)}))}}})),o=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-lowercase",description:"All attribute names must be in lowercase.",init:function(e,t,n){var a=this,r=Array.isArray(n)?n:[];e.addListener("tagstart",(function(e){for(var n,i=e.attrs,o=e.col+e.tagName.length+1,s=function(s,l){var u=(n=i[s]).name;r.find((function(e){return function(e,t){if(t instanceof RegExp)return!!t.test(e)&&{match:e,pattern:t};var n=t[0],a=t[t.length-1],r=t[t.length-2],i="/"===n&&("/"===a||"/"===r&&"i"===a);return i?i&&"i"===a?new RegExp(t.slice(1,-2),"i").test(e):new RegExp(t.slice(1,-1)).test(e):e===t}(u,e)}))||u===u.toLowerCase()||t.error("The attribute name of [ "+u+" ] must be in lowercase.",e.line,o+n.index,a,n.raw)},l=0,u=i.length;l<u;l++)s(l)}))}}})),s=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-sorted",description:"Attribute tags must be in proper order.",init:function(e,t){for(var n=this,a={},r=["class","id","name","src","for","type","href","value","title","alt","role"],i=0;i<r.length;i++)a[r[i]]=i;e.addListener("tagstart",(function(e){for(var r=e.attrs,i=[],o=0;o<r.length;o++)i.push(r[o].name);var s=JSON.stringify(i);i.sort((function(e,t){return null==a[e]&&null==a[t]?0:null==a[e]?1:null==a[t]?-1:a[e]-a[t]||e.localeCompare(t)})),s!==JSON.stringify(i)&&t.error("Inaccurate order "+s+" should be in hierarchy "+JSON.stringify(i)+" ",e.line,e.col,n,e.raw)}))}}})),l=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-no-duplication",description:"Elements cannot have duplicate attributes.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r,i=e.attrs,o=e.col+e.tagName.length+1,s={},l=0,u=i.length;l<u;l++)!0===s[r=(a=i[l]).name]&&t.error("Duplicate of attribute name [ "+a.name+" ] was found.",e.line,o+a.index,n,a.raw),s[r]=!0}))}}})),u=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-unsafe-chars",description:"Attribute values cannot contain unsafe chars.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r,i=e.attrs,o=e.col+e.tagName.length+1,s=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/,l=0,u=i.length;l<u;l++)if(a=i[l],null!==(r=s.exec(a.value))){var d=escape(r[0]).replace(/%u/,"\\u").replace(/%/,"\\x");t.warn("The value of attribute [ "+a.name+" ] cannot contain an unsafe char [ "+d+" ].",e.line,o+a.index,n,a.raw)}}))}}})),d=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-value-double-quotes",description:"Attribute values must be in double quotes.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r=e.attrs,i=e.col+e.tagName.length+1,o=0,s=r.length;o<s;o++)(""!==(a=r[o]).value&&'"'!==a.quote||""===a.value&&"'"===a.quote)&&t.error("The value of attribute [ "+a.name+" ] must be in double quotes.",e.line,i+a.index,n,a.raw)}))}}})),c=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-value-not-empty",description:"All attributes must have values.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r=e.attrs,i=e.col+e.tagName.length+1,o=0,s=r.length;o<s;o++)""===(a=r[o]).quote&&""===a.value&&t.warn("The attribute [ "+a.name+" ] must have a value.",e.line,i+a.index,n,a.raw)}))}}})),f=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-value-single-quotes",description:"Attribute values must be in single quotes.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r=e.attrs,i=e.col+e.tagName.length+1,o=0,s=r.length;o<s;o++)(""!==(a=r[o]).value&&"'"!==a.quote||""===a.value&&'"'===a.quote)&&t.error("The value of attribute [ "+a.name+" ] must be in single quotes.",e.line,i+a.index,n,a.raw)}))}}})),p=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-whitespace",description:"All attributes should be separated by only one space and not have leading/trailing whitespace.",init:function(e,t,n){var a=this,r=Array.isArray(n)?n:[];e.addListener("tagstart",(function(e){var n,i=e.attrs,o=e.col+e.tagName.length+1;i.forEach((function(i){n=i;var s=i.name;-1===r.indexOf(s)&&(i.value.trim()!==i.value&&t.error("The attributes of [ "+s+" ] must not have trailing whitespace.",e.line,o+n.index,a,n.raw),i.value.replace(/ +(?= )/g,"")!==i.value&&t.error("The attributes of [ "+s+" ] must be separated by only one space.",e.line,o+n.index,a,n.raw))}))}))}}})),g=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"doctype-first",description:"Doctype must be declared first.",init:function(e,t){var n=this,a=function(r){"start"===r.type||"text"===r.type&&/^\s*$/.test(r.raw)||(("comment"!==r.type&&!1===r.long||!1===/^DOCTYPE\s+/i.test(r.content))&&t.error("Doctype must be declared first.",r.line,r.col,n,r.raw),e.removeListener("all",a))};e.addListener("all",a)}}})),h=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"doctype-html5",description:'Invalid doctype. Use: "<!DOCTYPE html>"',init:function(e,t){var n=this,a=function(e){!1===e.long&&"doctype html"!==e.content.toLowerCase()&&t.warn('Invalid doctype. Use: "<!DOCTYPE html>"',e.line,e.col,n,e.raw)},r=function(){e.removeListener("comment",a),e.removeListener("tagstart",r)};e.addListener("all",a),e.addListener("tagstart",r)}}})),m=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"head-script-disabled",description:"The <script> tag cannot be used in a <head> tag.",init:function(e,t){var n=this,a=/^(text\/javascript|application\/javascript)$/i,r=!1,i=function(i){var o=e.getMapAttrs(i.attrs).type,s=i.tagName.toLowerCase();"head"===s&&(r=!0),!0!==r||"script"!==s||o&&!0!==a.test(o)||t.warn("The <script> tag cannot be used in a <head> tag.",i.line,i.col,n,i.raw)},o=function(t){"head"===t.tagName.toLowerCase()&&(e.removeListener("tagstart",i),e.removeListener("tagend",o))};e.addListener("tagstart",i),e.addListener("tagend",o)}}})),v=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"href-abs-or-rel",description:"An href attribute must be either absolute or relative.",init:function(e,t,n){var a=this,r="abs"===n?"absolute":"relative";e.addListener("tagstart",(function(e){for(var n,i=e.attrs,o=e.col+e.tagName.length+1,s=0,l=i.length;s<l;s++)if("href"===(n=i[s]).name){("absolute"===r&&!1===/^\w+?:/.test(n.value)||"relative"===r&&!0===/^https?:\/\//.test(n.value))&&t.warn("The value of the href attribute [ "+n.value+" ] must be "+r+".",e.line,o+n.index,a,n.raw);break}}))}}})),b=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=new RegExp("((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUse>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUse2>x(-[A-Za-z0-9]{1,8})+))","g");t.default={id:"html-lang-require",description:"The lang attribute of an <html> element must be present and should be valid.",init:function(e,t){var a=this;e.addListener("tagstart",(function(r){var i=r.tagName.toLowerCase(),o=e.getMapAttrs(r.attrs),s=r.col+i.length+1;"html"===i&&"lang"in o?o.lang?n.test(o.lang)||t.warn("The lang attribute value of <html> element must be a valid BCP47.",r.line,s,a,r.raw):t.warn("The lang attribute of <html> element must have a value.",r.line,s,a,r.raw):t.warn("An lang attribute must be present on <html> elements.",r.line,s,a,r.raw)}))}}})),y=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"id-class-ad-disabled",description:"The id and class attributes cannot use the ad keyword, it will be blocked by adblock software.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r,i=e.attrs,o=e.col+e.tagName.length+1,s=0,l=i.length;s<l;s++)r=(a=i[s]).name,/^(id|class)$/i.test(r)&&/(^|[-_])ad([-_]|$)/i.test(a.value)&&t.warn("The value of attribute "+r+" cannot use the ad keyword.",e.line,o+a.index,n,a.raw)}))}}})),w=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"id-class-value",description:"The id and class attribute values must meet the specified rules.",init:function(e,t,n){var a,r=this;if("object"==typeof(a="string"==typeof n?{underline:{regId:/^[a-z\d]+(_[a-z\d]+)*$/,message:"The id and class attribute values must be in lowercase and split by an underscore."},dash:{regId:/^[a-z\d]+(-[a-z\d]+)*$/,message:"The id and class attribute values must be in lowercase and split by a dash."},hump:{regId:/^[a-z][a-zA-Z\d]*([A-Z][a-zA-Z\d]*)*$/,message:"The id and class attribute values must meet the camelCase style."}}[n]:n)&&a.regId){var i=a.regId,o=a.message;i instanceof RegExp||(i=new RegExp(i)),e.addListener("tagstart",(function(e){for(var n,a=e.attrs,s=e.col+e.tagName.length+1,l=0,u=a.length;l<u;l++)if("id"===(n=a[l]).name.toLowerCase()&&!1===i.test(n.value)&&t.warn(o,e.line,s+n.index,r,n.raw),"class"===n.name.toLowerCase())for(var d=n.value.split(/\s+/g),c=void 0,f=0,p=d.length;f<p;f++)(c=d[f])&&!1===i.test(c)&&t.warn(o,e.line,s+n.index,r,c)}))}}}})),O=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"id-unique",description:"The value of id attributes must be unique.",init:function(e,t){var n=this,a={};e.addListener("tagstart",(function(e){for(var r,i,o=e.attrs,s=e.col+e.tagName.length+1,l=0,u=o.length;l<u;l++)if("id"===(r=o[l]).name.toLowerCase()){(i=r.value)&&(void 0===a[i]?a[i]=1:a[i]++,a[i]>1&&t.error("The id value [ "+i+" ] must be unique.",e.line,s+r.index,n,r.raw));break}}))}}})),x=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"inline-script-disabled",description:"Inline script cannot be used.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r,i=e.attrs,o=e.col+e.tagName.length+1,s=/^on(unload|message|submit|select|scroll|resize|mouseover|mouseout|mousemove|mouseleave|mouseenter|mousedown|load|keyup|keypress|keydown|focus|dblclick|click|change|blur|error)$/i,l=0,u=i.length;l<u;l++)r=(a=i[l]).name.toLowerCase(),!0===s.test(r)?t.warn("Inline script [ "+a.raw+" ] cannot be used.",e.line,o+a.index,n,a.raw):"src"!==r&&"href"!==r||/^\s*javascript:/i.test(a.value)&&t.warn("Inline script [ "+a.raw+" ] cannot be used.",e.line,o+a.index,n,a.raw)}))}}})),_=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"inline-style-disabled",description:"Inline style cannot be used.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r=e.attrs,i=e.col+e.tagName.length+1,o=0,s=r.length;o<s;o++)"style"===(a=r[o]).name.toLowerCase()&&t.warn("Inline style [ "+a.raw+" ] cannot be used.",e.line,i+a.index,n,a.raw)}))}}})),j=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"input-requires-label",description:"All [ input ] tags must have a corresponding [ label ] tag. ",init:function(e,t){var n=this,a=[],r=[];e.addListener("tagstart",(function(t){var n=t.tagName.toLowerCase(),i=e.getMapAttrs(t.attrs),o=t.col+n.length+1;"input"===n&&r.push({event:t,col:o,id:i.id}),"label"===n&&"for"in i&&""!==i.for&&a.push({event:t,col:o,forValue:i.for})})),e.addListener("end",(function(){r.forEach((function(e){(function(e){var t=!1;return a.forEach((function(n){e.id&&e.id===n.forValue&&(t=!0)})),t})(e)||t.warn("No matching [ label ] tag found.",e.event.line,e.col,n,e.event.raw)}))}))}}})),L=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"script-disabled",description:"The <script> tag cannot be used.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){"script"===e.tagName.toLowerCase()&&t.error("The <script> tag cannot be used.",e.line,e.col,n,e.raw)}))}}})),P=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"space-tab-mixed-disabled",description:"Do not mix tabs and spaces for indentation.",init:function(e,t,n){var a=this,r="nomix",i=null;if("string"==typeof n){var o=/^([a-z]+)(\d+)?/.exec(n);o&&(r=o[1],i=o[2]&&parseInt(o[2],10))}e.addListener("text",(function(n){for(var o,s=n.raw,l=/(^|\r?\n)([ \t]+)/g;o=l.exec(s);){var u=e.fixPos(n,o.index+o[1].length);if(1===u.col){var d=o[2];"space"===r?i?!1!==/^ +$/.test(d)&&d.length%i==0||t.warn("Please use space for indentation and keep "+i+" length.",u.line,1,a,n.raw):!1===/^ +$/.test(d)&&t.warn("Please use space for indentation.",u.line,1,a,n.raw):"tab"===r&&!1===/^\t+$/.test(d)?t.warn("Please use tab for indentation.",u.line,1,a,n.raw):!0===/ +\t|\t+ /.test(d)&&t.warn("Do not mix tabs and spaces for indentation.",u.line,1,a,n.raw)}}}))}}})),A=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"spec-char-escape",description:"Special characters must be escaped.",init:function(e,t){var n=this;e.addListener("text",(function(a){for(var r,i=a.raw,o=/([<>])|( \& )/g;r=o.exec(i);){var s=e.fixPos(a,r.index);t.error("Special characters must be escaped : [ "+r[0]+" ].",s.line,s.col,n,a.raw)}}))}}})),T=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"src-not-empty",description:"The src attribute of an img(script,link) must have a value.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r=e.tagName,i=e.attrs,o=e.col+r.length+1,s=0,l=i.length;s<l;s++)a=i[s],(!0===/^(img|script|embed|bgsound|iframe)$/.test(r)&&"src"===a.name||"link"===r&&"href"===a.name||"object"===r&&"data"===a.name)&&""===a.value&&t.error("The attribute [ "+a.name+" ] of the tag [ "+r+" ] must have a value.",e.line,o+a.index,n,a.raw)}))}}})),M=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"style-disabled",description:"<style> tags cannot be used.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){"style"===e.tagName.toLowerCase()&&t.warn("The <style> tag cannot be used.",e.line,e.col,n,e.raw)}))}}})),N=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"tag-pair",description:"Tag must be paired.",init:function(e,t){var n=this,a=[],r=e.makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(function(e){var t=e.tagName.toLowerCase();void 0!==r[t]||e.close||a.push({tagName:t,line:e.line,raw:e.raw})})),e.addListener("tagend",(function(e){var r,i=e.tagName.toLowerCase();for(r=a.length-1;r>=0&&a[r].tagName!==i;r--);if(r>=0){for(var o=[],s=a.length-1;s>r;s--)o.push("</"+a[s].tagName+">");if(o.length>0){var l=a[a.length-1];t.error("Tag must be paired, missing: [ "+o.join("")+" ], start tag match failed [ "+l.raw+" ] on line "+l.line+".",e.line,e.col,n,e.raw)}a.length=r}else t.error("Tag must be paired, no start tag: [ "+e.raw+" ]",e.line,e.col,n,e.raw)})),e.addListener("end",(function(e){for(var r=[],i=a.length-1;i>=0;i--)r.push("</"+a[i].tagName+">");if(r.length>0){var o=a[a.length-1];t.error("Tag must be paired, missing: [ "+r.join("")+" ], open tag match failed [ "+o.raw+" ] on line "+o.line+".",e.line,e.col,n,"")}}))}}})),k=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"tag-self-close",description:"Empty tags must be self closed.",init:function(e,t){var n=this,a=e.makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(function(e){var r=e.tagName.toLowerCase();void 0!==a[r]&&(e.close||t.warn("The empty tag : [ "+r+" ] must be self closed.",e.line,e.col,n,e.raw))}))}}})),C=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"tagname-lowercase",description:"All html element names must be in lowercase.",init:function(e,t,n){var a=this,r=Array.isArray(n)?n:[];e.addListener("tagstart,tagend",(function(e){var n=e.tagName;-1===r.indexOf(n)&&n!==n.toLowerCase()&&t.error("The html element name of [ "+n+" ] must be in lowercase.",e.line,e.col,a,e.raw)}))}}})),E=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"tagname-specialchars",description:"All html element names must be in lowercase.",init:function(e,t){var n=this,a=/[^a-zA-Z0-9\-:_]/;e.addListener("tagstart,tagend",(function(e){var r=e.tagName;a.test(r)&&t.error("The html element name of [ "+r+" ] contains special character.",e.line,e.col,n,e.raw)}))}}})),q=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"title-require",description:"<title> must be present in <head> tag.",init:function(e,t){var n=this,a=!1,r=!1,i=function(e){var t=e.tagName.toLowerCase();"head"===t?a=!0:"title"===t&&a&&(r=!0)},o=function(a){var s=a.tagName.toLowerCase();if(r&&"title"===s){var l=a.lastEvent;("text"!==l.type||"text"===l.type&&!0===/^\s*$/.test(l.raw))&&t.error("<title></title> must not be empty.",a.line,a.col,n,a.raw)}else"head"===s&&(!1===r&&t.error("<title> must be present in <head> tag.",a.line,a.col,n,a.raw),e.removeListener("tagstart",i),e.removeListener("tagend",o))};e.addListener("tagstart",i),e.addListener("tagend",o)}}})),z=n((function(t,n){var a=e&&e.__assign||function(){return(a=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};Object.defineProperty(n,"__esModule",{value:!0});var r={a:{selfclosing:!1,attrsRequired:["href","title"],redundantAttrs:["alt"]},div:{selfclosing:!1},main:{selfclosing:!1,redundantAttrs:["role"]},nav:{selfclosing:!1,redundantAttrs:["role"]},script:{attrsOptional:[["async","async"],["defer","defer"]]},img:{selfclosing:!0,attrsRequired:["src","alt","title"]}};n.default={id:"tags-check",description:"Checks html tags.",init:function(e,t,n){var i=this;r=a(a({},r),n),e.addListener("tagstart",(function(e){var n=e.attrs,a=e.col+e.tagName.length+1,o=e.tagName.toLowerCase();if(r[o]){var s=r[o];if(!0!==s.selfclosing||e.close?!1===s.selfclosing&&e.close&&t.warn("The <"+o+"> tag must not be selfclosing.",e.line,e.col,i,e.raw):t.warn("The <"+o+"> tag must be selfclosing.",e.line,e.col,i,e.raw),Array.isArray(s.attrsRequired))s.attrsRequired.forEach((function(r){if(Array.isArray(r)){var s=r.map((function(e){return e})),l=s.shift(),u=s;n.some((function(e){return e.name===l}))?n.forEach((function(n){n.name===l&&-1===u.indexOf(n.value)&&t.error("The <"+o+"> tag must have attr '"+l+"' with one value of '"+u.join("' or '")+"'.",e.line,a,i,e.raw)})):t.error("The <"+o+"> tag must have attr '"+l+"'.",e.line,a,i,e.raw)}else n.some((function(e){return-1!==r.split("|").indexOf(e.name)}))||t.error("The <"+o+"> tag must have attr '"+r+"'.",e.line,a,i,e.raw)}));if(Array.isArray(s.attrsOptional))s.attrsOptional.forEach((function(r){if(Array.isArray(r)){var s=r.map((function(e){return e})),l=s.shift(),u=s;n.some((function(e){return e.name===l}))&&n.forEach((function(n){n.name===l&&-1===u.indexOf(n.value)&&t.error("The <"+o+"> tag must have optional attr '"+l+"' with one value of '"+u.join("' or '")+"'.",e.line,a,i,e.raw)}))}}));if(Array.isArray(s.redundantAttrs))s.redundantAttrs.forEach((function(r){n.some((function(e){return e.name===r}))&&t.error("The attr '"+r+"' is redundant for <"+o+"> and should be ommited.",e.line,a,i,e.raw)}))}}))}}})),R=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-no-unnecessary-whitespace",description:"No spaces between attribute names and values.",init:function(e,t,n){var a=this,r=Array.isArray(n)?n:[];e.addListener("tagstart",(function(e){for(var n=e.attrs,i=e.col+e.tagName.length+1,o=0;o<n.length;o++)if(-1===r.indexOf(n[o].name)){var s=/(\s*)=(\s*)/.exec(n[o].raw.trim());!s||0===s[1].length&&0===s[2].length||t.error("The attribute '"+n[o].name+"' must not have spaces between the name and value.",e.line,i+n[o].index,a,n[o].raw)}}))}}})),D=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"altRequire",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"attrLowercase",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"attrSort",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"attrNoDuplication",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"attrUnsafeChars",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"attrValueDoubleQuotes",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(t,"attrValueNotEmpty",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(t,"attrValueSingleQuotes",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(t,"attrWhitespace",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(t,"doctypeFirst",{enumerable:!0,get:function(){return g.default}}),Object.defineProperty(t,"doctypeHTML5",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(t,"headScriptDisabled",{enumerable:!0,get:function(){return m.default}}),Object.defineProperty(t,"hrefAbsOrRel",{enumerable:!0,get:function(){return v.default}}),Object.defineProperty(t,"htmlLangRequire",{enumerable:!0,get:function(){return b.default}}),Object.defineProperty(t,"idClsasAdDisabled",{enumerable:!0,get:function(){return y.default}}),Object.defineProperty(t,"idClassValue",{enumerable:!0,get:function(){return w.default}}),Object.defineProperty(t,"idUnique",{enumerable:!0,get:function(){return O.default}}),Object.defineProperty(t,"inlineScriptDisabled",{enumerable:!0,get:function(){return x.default}}),Object.defineProperty(t,"inlineStyleDisabled",{enumerable:!0,get:function(){return _.default}}),Object.defineProperty(t,"inputRequiresLabel",{enumerable:!0,get:function(){return j.default}}),Object.defineProperty(t,"scriptDisabled",{enumerable:!0,get:function(){return L.default}}),Object.defineProperty(t,"spaceTabMixedDisabled",{enumerable:!0,get:function(){return P.default}}),Object.defineProperty(t,"specCharEscape",{enumerable:!0,get:function(){return A.default}}),Object.defineProperty(t,"srcNotEmpty",{enumerable:!0,get:function(){return T.default}}),Object.defineProperty(t,"styleDisabled",{enumerable:!0,get:function(){return M.default}}),Object.defineProperty(t,"tagPair",{enumerable:!0,get:function(){return N.default}}),Object.defineProperty(t,"tagSelfClose",{enumerable:!0,get:function(){return k.default}}),Object.defineProperty(t,"tagnameLowercase",{enumerable:!0,get:function(){return C.default}}),Object.defineProperty(t,"tagnameSpecialChars",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(t,"titleRequire",{enumerable:!0,get:function(){return q.default}}),Object.defineProperty(t,"tagsCheck",{enumerable:!0,get:function(){return z.default}}),Object.defineProperty(t,"attrNoUnnecessaryWhitespace",{enumerable:!0,get:function(){return R.default}})}));return t(n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.HTMLParser=t.Reporter=t.HTMLRules=t.HTMLHint=void 0,t.HTMLParser=a.default,t.Reporter=r.default,t.HTMLRules=D;var n=function(){function e(){this.rules={},this.defaultRuleset={"tagname-lowercase":!0,"attr-lowercase":!0,"attr-value-double-quotes":!0,"doctype-first":!0,"tag-pair":!0,"spec-char-escape":!0,"id-unique":!0,"src-not-empty":!0,"attr-no-duplication":!0,"title-require":!0}}return e.prototype.addRule=function(e){this.rules[e.id]=e},e.prototype.verify=function(e,t){void 0===t&&(t=this.defaultRuleset),0===Object.keys(t).length&&(t=this.defaultRuleset),e=e.replace(/^\s*<!--\s*htmlhint\s+([^\r\n]+?)\s*-->/i,(function(e,n){return n.replace(/(?:^|,)\s*([^:,]+)\s*(?:\:\s*([^,\s]+))?/g,(function(e,n,a){return t[n]=!(void 0!==a&&a.length>0)||JSON.parse(a),""})),""}));var n,i=new a.default,o=new r.default(e,t),s=this.rules;for(var l in t)void 0!==(n=s[l])&&!1!==t[l]&&n.init(i,o,t[l]);return i.parse(e),o.messages},e.prototype.format=function(e,t){void 0===t&&(t={});var n=[],a={white:"",grey:"",red:"",reset:""};t.colors&&(a.white="[37m",a.grey="[90m",a.red="[31m",a.reset="[39m");var r=t.indent||0;return e.forEach((function(e){var t=e.evidence,o=e.line,s=e.col,l=t.length,u=s>41?s-40:1,d=t.length>s+60?s+60:l;s<41&&(d+=40-s+1),t=t.replace(/\t/g," ").substring(u-1,d),u>1&&(t="..."+t,u-=3),d<l&&(t+="..."),n.push(a.white+i(r)+"L"+o+" |"+a.grey+t+a.reset);var c=s-u,f=t.substring(0,c).match(/[^\u0000-\u00ff]/g);null!==f&&(c+=f.length),n.push(a.white+i(r)+i(String(o).length+3+c)+"^ "+a.red+e.message+" ("+e.rule.id+")"+a.reset)})),n},e}();function i(e,t){return new Array(e+1).join(t||" ")}t.HTMLHint=new n,Object.keys(D).forEach((function(e){t.HTMLHint.addRule(D[e])}))})))})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).HTMLHint=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var a=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this._listeners={},this._mapCdataTags=this.makeMap("script,style"),this._arrBlocks=[],this.lastEvent=null}return e.prototype.makeMap=function(e){for(var t={},n=e.split(","),a=0;a<n.length;a++)t[n[a]]=!0;return t},e.prototype.parse=function(e){var t,n,a,r,i,o,s=this,l=this._mapCdataTags,u=/<(?:\/([^\s>]+)\s*|!--([\s\S]*?)--|!([^>]*?)|([\w\-:]+)((?:\s+[^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]*))?)*?)\s*(\/?))>/g,d=/\s*([^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+)(?:\s*=\s*(?:(")([^"]*)"|(')([^']*)'|([^\s"'>]*)))?/g,c=/\r?\n/g,f=0,p=null,g=[],h=0,m=0,v=1,b=this._arrBlocks;this.fire("start",{pos:0,line:1,col:1});for(var y,w=function(e,t,n,a){var r=n-m+1;for(void 0===a&&(a={}),a.raw=t,a.pos=n,a.line=v,a.col=r,b.push(a),s.fire(e,a);c.exec(t);)v++,m=n+c.lastIndex};t=u.exec(e);)if((n=t.index)>f&&(o=e.substring(f,n),p?g.push(o):w("text",o,f)),f=u.lastIndex,!(a=t[1])||(p&&a===p&&(w("cdata",o=g.join(""),h,{tagName:p,attrs:i}),p=null,i=void 0,g=[]),p))if(p)g.push(t[0]);else if(a=t[4]){r=[];for(var O=t[5],x=void 0,_=0;x=d.exec(O);){var j=x[1],L=x[2]?x[2]:x[4]?x[4]:"",P=x[3]?x[3]:x[5]?x[5]:x[6]?x[6]:"";r.push({name:j,value:P,quote:L,index:x.index,raw:x[0]}),_+=x[0].length}_===O.length?(w("tagstart",t[0],n,{tagName:a,attrs:r,close:t[6]}),y=void 0,y=r.find((function(e){return"type"===e.name}))||{value:""},l[a]&&-1===y.value.indexOf("text/ng-template")&&(p=a,i=r.concat(),g=[],h=f)):w("text",t[0],n)}else(t[2]||t[3])&&w("comment",t[0],n,{content:t[2]||t[3],long:!!t[2]});else w("tagend",t[0],n,{tagName:a});e.length>f&&w("text",o=e.substring(f,e.length),f),this.fire("end",{pos:f,line:v,col:e.length-m+1})},e.prototype.addListener=function(e,t){for(var n,a=this._listeners,r=e.split(/[,\s]/),i=0,o=r.length;i<o;i++)void 0===a[n=r[i]]&&(a[n]=[]),a[n].push(t)},e.prototype.fire=function(e,t){void 0===t&&(t={}),t.type=e;var n=[],a=this._listeners[e],r=this._listeners.all;void 0!==a&&(n=n.concat(a)),void 0!==r&&(n=n.concat(r));var i=this.lastEvent;null!==i&&(delete i.lastEvent,t.lastEvent=i),this.lastEvent=t;for(var o=0,s=n.length;o<s;o++)n[o].call(this,t)},e.prototype.removeListener=function(e,t){var n=this._listeners[e];if(void 0!==n)for(var a=0,r=n.length;a<r;a++)if(n[a]===t){n.splice(a,1);break}},e.prototype.fixPos=function(e,t){var n,a=e.raw.substr(0,t).split(/\r?\n/),r=a.length-1,i=e.line;return r>0?(i+=r,n=a[r].length+1):n=e.col+t,{line:i,col:n}},e.prototype.getMapAttrs=function(e){for(var t,n={},a=0,r=e.length;a<r;a++)n[(t=e[a]).name]=t.value;return n},e}();t.default=n})),r=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this.html=e,this.lines=e.split(/\r?\n/);var n=/\r?\n/.exec(e);this.brLen=null!==n?n[0].length:0,this.ruleset=t,this.messages=[]}return e.prototype.info=function(e,t,n,a,r){this.report("info",e,t,n,a,r)},e.prototype.warn=function(e,t,n,a,r){this.report("warning",e,t,n,a,r)},e.prototype.error=function(e,t,n,a,r){this.report("error",e,t,n,a,r)},e.prototype.report=function(e,t,n,a,r,i){for(var o=this.lines,s=this.brLen,l="",u=0,d=n-1,c=o.length;d<c&&(a>(u=(l=o[d]).length)&&n<c);d++)n++,1!==(a-=u)&&(a-=s);this.messages.push({type:e,message:t,raw:i,evidence:l,line:n,col:a,rule:{id:r.id,description:r.description,link:"https://github.com/thedaviddias/HTMLHint/wiki/"+r.id}})},e}();t.default=n})),i=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"alt-require",description:"The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",init:function(e,t){var n=this;e.addListener("tagstart",(function(a){var r,i=a.tagName.toLowerCase(),o=e.getMapAttrs(a.attrs),s=a.col+i.length+1;"img"!==i||"alt"in o?("area"===i&&"href"in o||"input"===i&&"image"===o.type)&&("alt"in o&&""!==o.alt||(r="area"===i?"area[href]":"input[type=image]",t.warn("The alt attribute of "+r+" must have a value.",a.line,s,n,a.raw))):t.warn("An alt attribute must be present on <img> elements.",a.line,s,n,a.raw)}))}}})),o=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-lowercase",description:"All attribute names must be in lowercase.",init:function(e,t,n){var a=this,r=Array.isArray(n)?n:[];e.addListener("tagstart",(function(e){for(var n,i=e.attrs,o=e.col+e.tagName.length+1,s=function(s,l){var u=(n=i[s]).name;r.find((function(e){return function(e,t){if(t instanceof RegExp)return!!t.test(e)&&{match:e,pattern:t};var n=t[0],a=t[t.length-1],r=t[t.length-2],i="/"===n&&("/"===a||"/"===r&&"i"===a);return i?i&&"i"===a?new RegExp(t.slice(1,-2),"i").test(e):new RegExp(t.slice(1,-1)).test(e):e===t}(u,e)}))||u===u.toLowerCase()||t.error("The attribute name of [ "+u+" ] must be in lowercase.",e.line,o+n.index,a,n.raw)},l=0,u=i.length;l<u;l++)s(l)}))}}})),s=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-sorted",description:"Attribute tags must be in proper order.",init:function(e,t){for(var n=this,a={},r=["class","id","name","src","for","type","href","value","title","alt","role"],i=0;i<r.length;i++)a[r[i]]=i;e.addListener("tagstart",(function(e){for(var r=e.attrs,i=[],o=0;o<r.length;o++)i.push(r[o].name);var s=JSON.stringify(i);i.sort((function(e,t){return null==a[e]&&null==a[t]?0:null==a[e]?1:null==a[t]?-1:a[e]-a[t]||e.localeCompare(t)})),s!==JSON.stringify(i)&&t.error("Inaccurate order "+s+" should be in hierarchy "+JSON.stringify(i)+" ",e.line,e.col,n,e.raw)}))}}})),l=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-no-duplication",description:"Elements cannot have duplicate attributes.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r,i=e.attrs,o=e.col+e.tagName.length+1,s={},l=0,u=i.length;l<u;l++)!0===s[r=(a=i[l]).name]&&t.error("Duplicate of attribute name [ "+a.name+" ] was found.",e.line,o+a.index,n,a.raw),s[r]=!0}))}}})),u=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-unsafe-chars",description:"Attribute values cannot contain unsafe chars.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r,i=e.attrs,o=e.col+e.tagName.length+1,s=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/,l=0,u=i.length;l<u;l++)if(a=i[l],null!==(r=s.exec(a.value))){var d=escape(r[0]).replace(/%u/,"\\u").replace(/%/,"\\x");t.warn("The value of attribute [ "+a.name+" ] cannot contain an unsafe char [ "+d+" ].",e.line,o+a.index,n,a.raw)}}))}}})),d=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-value-double-quotes",description:"Attribute values must be in double quotes.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r=e.attrs,i=e.col+e.tagName.length+1,o=0,s=r.length;o<s;o++)(""!==(a=r[o]).value&&'"'!==a.quote||""===a.value&&"'"===a.quote)&&t.error("The value of attribute [ "+a.name+" ] must be in double quotes.",e.line,i+a.index,n,a.raw)}))}}})),c=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-value-not-empty",description:"All attributes must have values.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r=e.attrs,i=e.col+e.tagName.length+1,o=0,s=r.length;o<s;o++)""===(a=r[o]).quote&&""===a.value&&t.warn("The attribute [ "+a.name+" ] must have a value.",e.line,i+a.index,n,a.raw)}))}}})),f=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-value-single-quotes",description:"Attribute values must be in single quotes.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r=e.attrs,i=e.col+e.tagName.length+1,o=0,s=r.length;o<s;o++)(""!==(a=r[o]).value&&"'"!==a.quote||""===a.value&&'"'===a.quote)&&t.error("The value of attribute [ "+a.name+" ] must be in single quotes.",e.line,i+a.index,n,a.raw)}))}}})),p=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-whitespace",description:"All attributes should be separated by only one space and not have leading/trailing whitespace.",init:function(e,t,n){var a=this,r=Array.isArray(n)?n:[];e.addListener("tagstart",(function(e){var n,i=e.attrs,o=e.col+e.tagName.length+1;i.forEach((function(i){n=i;var s=i.name;-1===r.indexOf(s)&&(i.value.trim()!==i.value&&t.error("The attributes of [ "+s+" ] must not have trailing whitespace.",e.line,o+n.index,a,n.raw),i.value.replace(/ +(?= )/g,"")!==i.value&&t.error("The attributes of [ "+s+" ] must be separated by only one space.",e.line,o+n.index,a,n.raw))}))}))}}})),g=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"doctype-first",description:"Doctype must be declared first.",init:function(e,t){var n=this,a=function(r){"start"===r.type||"text"===r.type&&/^\s*$/.test(r.raw)||(("comment"!==r.type&&!1===r.long||!1===/^DOCTYPE\s+/i.test(r.content))&&t.error("Doctype must be declared first.",r.line,r.col,n,r.raw),e.removeListener("all",a))};e.addListener("all",a)}}})),h=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"doctype-html5",description:'Invalid doctype. Use: "<!DOCTYPE html>"',init:function(e,t){var n=this,a=function(e){!1===e.long&&"doctype html"!==e.content.toLowerCase()&&t.warn('Invalid doctype. Use: "<!DOCTYPE html>"',e.line,e.col,n,e.raw)},r=function(){e.removeListener("comment",a),e.removeListener("tagstart",r)};e.addListener("all",a),e.addListener("tagstart",r)}}})),m=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"head-script-disabled",description:"The <script> tag cannot be used in a <head> tag.",init:function(e,t){var n=this,a=/^(text\/javascript|application\/javascript)$/i,r=!1,i=function(i){var o=e.getMapAttrs(i.attrs).type,s=i.tagName.toLowerCase();"head"===s&&(r=!0),!0!==r||"script"!==s||o&&!0!==a.test(o)||t.warn("The <script> tag cannot be used in a <head> tag.",i.line,i.col,n,i.raw)},o=function(t){"head"===t.tagName.toLowerCase()&&(e.removeListener("tagstart",i),e.removeListener("tagend",o))};e.addListener("tagstart",i),e.addListener("tagend",o)}}})),v=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"href-abs-or-rel",description:"An href attribute must be either absolute or relative.",init:function(e,t,n){var a=this,r="abs"===n?"absolute":"relative";e.addListener("tagstart",(function(e){for(var n,i=e.attrs,o=e.col+e.tagName.length+1,s=0,l=i.length;s<l;s++)if("href"===(n=i[s]).name){("absolute"===r&&!1===/^\w+?:/.test(n.value)||"relative"===r&&!0===/^https?:\/\//.test(n.value))&&t.warn("The value of the href attribute [ "+n.value+" ] must be "+r+".",e.line,o+n.index,a,n.raw);break}}))}}})),b=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});t.default={id:"html-lang-require",description:"The lang attribute of an <html> element must be present and should be valid.",init:function(e,t){var n=this;e.addListener("tagstart",(function(a){var r=a.tagName.toLowerCase(),i=e.getMapAttrs(a.attrs),o=a.col+r.length+1,s=new RegExp("((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUse>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUse2>x(-[A-Za-z0-9]{1,8})+))","g");"html"===r&&("lang"in i?i.lang?s.test(i.lang)||t.warn("The lang attribute value of <html> element must be a valid BCP47.",a.line,o,n,a.raw):t.warn("The lang attribute of <html> element must have a value.",a.line,o,n,a.raw):t.warn("An lang attribute must be present on <html> elements.",a.line,o,n,a.raw))}))}}})),y=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"id-class-ad-disabled",description:"The id and class attributes cannot use the ad keyword, it will be blocked by adblock software.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r,i=e.attrs,o=e.col+e.tagName.length+1,s=0,l=i.length;s<l;s++)r=(a=i[s]).name,/^(id|class)$/i.test(r)&&/(^|[-_])ad([-_]|$)/i.test(a.value)&&t.warn("The value of attribute "+r+" cannot use the ad keyword.",e.line,o+a.index,n,a.raw)}))}}})),w=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"id-class-value",description:"The id and class attribute values must meet the specified rules.",init:function(e,t,n){var a,r=this;if("object"==typeof(a="string"==typeof n?{underline:{regId:/^[a-z\d]+(_[a-z\d]+)*$/,message:"The id and class attribute values must be in lowercase and split by an underscore."},dash:{regId:/^[a-z\d]+(-[a-z\d]+)*$/,message:"The id and class attribute values must be in lowercase and split by a dash."},hump:{regId:/^[a-z][a-zA-Z\d]*([A-Z][a-zA-Z\d]*)*$/,message:"The id and class attribute values must meet the camelCase style."}}[n]:n)&&a.regId){var i=a.regId,o=a.message;i instanceof RegExp||(i=new RegExp(i)),e.addListener("tagstart",(function(e){for(var n,a=e.attrs,s=e.col+e.tagName.length+1,l=0,u=a.length;l<u;l++)if("id"===(n=a[l]).name.toLowerCase()&&!1===i.test(n.value)&&t.warn(o,e.line,s+n.index,r,n.raw),"class"===n.name.toLowerCase())for(var d=n.value.split(/\s+/g),c=void 0,f=0,p=d.length;f<p;f++)(c=d[f])&&!1===i.test(c)&&t.warn(o,e.line,s+n.index,r,c)}))}}}})),O=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"id-unique",description:"The value of id attributes must be unique.",init:function(e,t){var n=this,a={};e.addListener("tagstart",(function(e){for(var r,i,o=e.attrs,s=e.col+e.tagName.length+1,l=0,u=o.length;l<u;l++)if("id"===(r=o[l]).name.toLowerCase()){(i=r.value)&&(void 0===a[i]?a[i]=1:a[i]++,a[i]>1&&t.error("The id value [ "+i+" ] must be unique.",e.line,s+r.index,n,r.raw));break}}))}}})),x=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"inline-script-disabled",description:"Inline script cannot be used.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r,i=e.attrs,o=e.col+e.tagName.length+1,s=/^on(unload|message|submit|select|scroll|resize|mouseover|mouseout|mousemove|mouseleave|mouseenter|mousedown|load|keyup|keypress|keydown|focus|dblclick|click|change|blur|error)$/i,l=0,u=i.length;l<u;l++)r=(a=i[l]).name.toLowerCase(),!0===s.test(r)?t.warn("Inline script [ "+a.raw+" ] cannot be used.",e.line,o+a.index,n,a.raw):"src"!==r&&"href"!==r||/^\s*javascript:/i.test(a.value)&&t.warn("Inline script [ "+a.raw+" ] cannot be used.",e.line,o+a.index,n,a.raw)}))}}})),_=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"inline-style-disabled",description:"Inline style cannot be used.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r=e.attrs,i=e.col+e.tagName.length+1,o=0,s=r.length;o<s;o++)"style"===(a=r[o]).name.toLowerCase()&&t.warn("Inline style [ "+a.raw+" ] cannot be used.",e.line,i+a.index,n,a.raw)}))}}})),j=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"input-requires-label",description:"All [ input ] tags must have a corresponding [ label ] tag. ",init:function(e,t){var n=this,a=[],r=[];e.addListener("tagstart",(function(t){var n=t.tagName.toLowerCase(),i=e.getMapAttrs(t.attrs),o=t.col+n.length+1;"input"===n&&r.push({event:t,col:o,id:i.id}),"label"===n&&"for"in i&&""!==i.for&&a.push({event:t,col:o,forValue:i.for})})),e.addListener("end",(function(){r.forEach((function(e){(function(e){var t=!1;return a.forEach((function(n){e.id&&e.id===n.forValue&&(t=!0)})),t})(e)||t.warn("No matching [ label ] tag found.",e.event.line,e.col,n,e.event.raw)}))}))}}})),L=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"script-disabled",description:"The <script> tag cannot be used.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){"script"===e.tagName.toLowerCase()&&t.error("The <script> tag cannot be used.",e.line,e.col,n,e.raw)}))}}})),P=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"space-tab-mixed-disabled",description:"Do not mix tabs and spaces for indentation.",init:function(e,t,n){var a=this,r="nomix",i=null;if("string"==typeof n){var o=/^([a-z]+)(\d+)?/.exec(n);o&&(r=o[1],i=o[2]&&parseInt(o[2],10))}e.addListener("text",(function(n){for(var o,s=n.raw,l=/(^|\r?\n)([ \t]+)/g;o=l.exec(s);){var u=e.fixPos(n,o.index+o[1].length);if(1===u.col){var d=o[2];"space"===r?i?!1!==/^ +$/.test(d)&&d.length%i==0||t.warn("Please use space for indentation and keep "+i+" length.",u.line,1,a,n.raw):!1===/^ +$/.test(d)&&t.warn("Please use space for indentation.",u.line,1,a,n.raw):"tab"===r&&!1===/^\t+$/.test(d)?t.warn("Please use tab for indentation.",u.line,1,a,n.raw):!0===/ +\t|\t+ /.test(d)&&t.warn("Do not mix tabs and spaces for indentation.",u.line,1,a,n.raw)}}}))}}})),A=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"spec-char-escape",description:"Special characters must be escaped.",init:function(e,t){var n=this;e.addListener("text",(function(a){for(var r,i=a.raw,o=/([<>])|( \& )/g;r=o.exec(i);){var s=e.fixPos(a,r.index);t.error("Special characters must be escaped : [ "+r[0]+" ].",s.line,s.col,n,a.raw)}}))}}})),T=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"src-not-empty",description:"The src attribute of an img(script,link) must have a value.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){for(var a,r=e.tagName,i=e.attrs,o=e.col+r.length+1,s=0,l=i.length;s<l;s++)a=i[s],(!0===/^(img|script|embed|bgsound|iframe)$/.test(r)&&"src"===a.name||"link"===r&&"href"===a.name||"object"===r&&"data"===a.name)&&""===a.value&&t.error("The attribute [ "+a.name+" ] of the tag [ "+r+" ] must have a value.",e.line,o+a.index,n,a.raw)}))}}})),M=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"style-disabled",description:"<style> tags cannot be used.",init:function(e,t){var n=this;e.addListener("tagstart",(function(e){"style"===e.tagName.toLowerCase()&&t.warn("The <style> tag cannot be used.",e.line,e.col,n,e.raw)}))}}})),N=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"tag-pair",description:"Tag must be paired.",init:function(e,t){var n=this,a=[],r=e.makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(function(e){var t=e.tagName.toLowerCase();void 0!==r[t]||e.close||a.push({tagName:t,line:e.line,raw:e.raw})})),e.addListener("tagend",(function(e){var r,i=e.tagName.toLowerCase();for(r=a.length-1;r>=0&&a[r].tagName!==i;r--);if(r>=0){for(var o=[],s=a.length-1;s>r;s--)o.push("</"+a[s].tagName+">");if(o.length>0){var l=a[a.length-1];t.error("Tag must be paired, missing: [ "+o.join("")+" ], start tag match failed [ "+l.raw+" ] on line "+l.line+".",e.line,e.col,n,e.raw)}a.length=r}else t.error("Tag must be paired, no start tag: [ "+e.raw+" ]",e.line,e.col,n,e.raw)})),e.addListener("end",(function(e){for(var r=[],i=a.length-1;i>=0;i--)r.push("</"+a[i].tagName+">");if(r.length>0){var o=a[a.length-1];t.error("Tag must be paired, missing: [ "+r.join("")+" ], open tag match failed [ "+o.raw+" ] on line "+o.line+".",e.line,e.col,n,"")}}))}}})),k=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"tag-self-close",description:"Empty tags must be self closed.",init:function(e,t){var n=this,a=e.makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(function(e){var r=e.tagName.toLowerCase();void 0!==a[r]&&(e.close||t.warn("The empty tag : [ "+r+" ] must be self closed.",e.line,e.col,n,e.raw))}))}}})),C=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"tagname-lowercase",description:"All html element names must be in lowercase.",init:function(e,t,n){var a=this,r=Array.isArray(n)?n:[];e.addListener("tagstart,tagend",(function(e){var n=e.tagName;-1===r.indexOf(n)&&n!==n.toLowerCase()&&t.error("The html element name of [ "+n+" ] must be in lowercase.",e.line,e.col,a,e.raw)}))}}})),E=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"tagname-specialchars",description:"All html element names must be in lowercase.",init:function(e,t){var n=this,a=/[^a-zA-Z0-9\-:_]/;e.addListener("tagstart,tagend",(function(e){var r=e.tagName;a.test(r)&&t.error("The html element name of [ "+r+" ] contains special character.",e.line,e.col,n,e.raw)}))}}})),q=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"title-require",description:"<title> must be present in <head> tag.",init:function(e,t){var n=this,a=!1,r=!1,i=function(e){var t=e.tagName.toLowerCase();"head"===t?a=!0:"title"===t&&a&&(r=!0)},o=function(a){var s=a.tagName.toLowerCase();if(r&&"title"===s){var l=a.lastEvent;("text"!==l.type||"text"===l.type&&!0===/^\s*$/.test(l.raw))&&t.error("<title></title> must not be empty.",a.line,a.col,n,a.raw)}else"head"===s&&(!1===r&&t.error("<title> must be present in <head> tag.",a.line,a.col,n,a.raw),e.removeListener("tagstart",i),e.removeListener("tagend",o))};e.addListener("tagstart",i),e.addListener("tagend",o)}}})),z=n((function(t,n){var a=e&&e.__assign||function(){return(a=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};Object.defineProperty(n,"__esModule",{value:!0});var r={a:{selfclosing:!1,attrsRequired:["href","title"],redundantAttrs:["alt"]},div:{selfclosing:!1},main:{selfclosing:!1,redundantAttrs:["role"]},nav:{selfclosing:!1,redundantAttrs:["role"]},script:{attrsOptional:[["async","async"],["defer","defer"]]},img:{selfclosing:!0,attrsRequired:["src","alt","title"]}};n.default={id:"tags-check",description:"Checks html tags.",init:function(e,t,n){var i=this;r=a(a({},r),n),e.addListener("tagstart",(function(e){var n=e.attrs,a=e.col+e.tagName.length+1,o=e.tagName.toLowerCase();if(r[o]){var s=r[o];if(!0!==s.selfclosing||e.close?!1===s.selfclosing&&e.close&&t.warn("The <"+o+"> tag must not be selfclosing.",e.line,e.col,i,e.raw):t.warn("The <"+o+"> tag must be selfclosing.",e.line,e.col,i,e.raw),Array.isArray(s.attrsRequired))s.attrsRequired.forEach((function(r){if(Array.isArray(r)){var s=r.map((function(e){return e})),l=s.shift(),u=s;n.some((function(e){return e.name===l}))?n.forEach((function(n){n.name===l&&-1===u.indexOf(n.value)&&t.error("The <"+o+"> tag must have attr '"+l+"' with one value of '"+u.join("' or '")+"'.",e.line,a,i,e.raw)})):t.error("The <"+o+"> tag must have attr '"+l+"'.",e.line,a,i,e.raw)}else n.some((function(e){return-1!==r.split("|").indexOf(e.name)}))||t.error("The <"+o+"> tag must have attr '"+r+"'.",e.line,a,i,e.raw)}));if(Array.isArray(s.attrsOptional))s.attrsOptional.forEach((function(r){if(Array.isArray(r)){var s=r.map((function(e){return e})),l=s.shift(),u=s;n.some((function(e){return e.name===l}))&&n.forEach((function(n){n.name===l&&-1===u.indexOf(n.value)&&t.error("The <"+o+"> tag must have optional attr '"+l+"' with one value of '"+u.join("' or '")+"'.",e.line,a,i,e.raw)}))}}));if(Array.isArray(s.redundantAttrs))s.redundantAttrs.forEach((function(r){n.some((function(e){return e.name===r}))&&t.error("The attr '"+r+"' is redundant for <"+o+"> and should be ommited.",e.line,a,i,e.raw)}))}}))}}})),R=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={id:"attr-no-unnecessary-whitespace",description:"No spaces between attribute names and values.",init:function(e,t,n){var a=this,r=Array.isArray(n)?n:[];e.addListener("tagstart",(function(e){for(var n=e.attrs,i=e.col+e.tagName.length+1,o=0;o<n.length;o++)if(-1===r.indexOf(n[o].name)){var s=/(\s*)=(\s*)/.exec(n[o].raw.trim());!s||0===s[1].length&&0===s[2].length||t.error("The attribute '"+n[o].name+"' must not have spaces between the name and value.",e.line,i+n[o].index,a,n[o].raw)}}))}}})),D=n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"altRequire",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"attrLowercase",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"attrSort",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"attrNoDuplication",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"attrUnsafeChars",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"attrValueDoubleQuotes",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(t,"attrValueNotEmpty",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(t,"attrValueSingleQuotes",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(t,"attrWhitespace",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(t,"doctypeFirst",{enumerable:!0,get:function(){return g.default}}),Object.defineProperty(t,"doctypeHTML5",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(t,"headScriptDisabled",{enumerable:!0,get:function(){return m.default}}),Object.defineProperty(t,"hrefAbsOrRel",{enumerable:!0,get:function(){return v.default}}),Object.defineProperty(t,"htmlLangRequire",{enumerable:!0,get:function(){return b.default}}),Object.defineProperty(t,"idClsasAdDisabled",{enumerable:!0,get:function(){return y.default}}),Object.defineProperty(t,"idClassValue",{enumerable:!0,get:function(){return w.default}}),Object.defineProperty(t,"idUnique",{enumerable:!0,get:function(){return O.default}}),Object.defineProperty(t,"inlineScriptDisabled",{enumerable:!0,get:function(){return x.default}}),Object.defineProperty(t,"inlineStyleDisabled",{enumerable:!0,get:function(){return _.default}}),Object.defineProperty(t,"inputRequiresLabel",{enumerable:!0,get:function(){return j.default}}),Object.defineProperty(t,"scriptDisabled",{enumerable:!0,get:function(){return L.default}}),Object.defineProperty(t,"spaceTabMixedDisabled",{enumerable:!0,get:function(){return P.default}}),Object.defineProperty(t,"specCharEscape",{enumerable:!0,get:function(){return A.default}}),Object.defineProperty(t,"srcNotEmpty",{enumerable:!0,get:function(){return T.default}}),Object.defineProperty(t,"styleDisabled",{enumerable:!0,get:function(){return M.default}}),Object.defineProperty(t,"tagPair",{enumerable:!0,get:function(){return N.default}}),Object.defineProperty(t,"tagSelfClose",{enumerable:!0,get:function(){return k.default}}),Object.defineProperty(t,"tagnameLowercase",{enumerable:!0,get:function(){return C.default}}),Object.defineProperty(t,"tagnameSpecialChars",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(t,"titleRequire",{enumerable:!0,get:function(){return q.default}}),Object.defineProperty(t,"tagsCheck",{enumerable:!0,get:function(){return z.default}}),Object.defineProperty(t,"attrNoUnnecessaryWhitespace",{enumerable:!0,get:function(){return R.default}})}));return t(n((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.HTMLParser=t.Reporter=t.HTMLRules=t.HTMLHint=void 0,t.HTMLParser=a.default,t.Reporter=r.default,t.HTMLRules=D;var n=function(){function e(){this.rules={},this.defaultRuleset={"tagname-lowercase":!0,"attr-lowercase":!0,"attr-value-double-quotes":!0,"doctype-first":!0,"tag-pair":!0,"spec-char-escape":!0,"id-unique":!0,"src-not-empty":!0,"attr-no-duplication":!0,"title-require":!0}}return e.prototype.addRule=function(e){this.rules[e.id]=e},e.prototype.verify=function(e,t){void 0===t&&(t=this.defaultRuleset),0===Object.keys(t).length&&(t=this.defaultRuleset),e=e.replace(/^\s*<!--\s*htmlhint\s+([^\r\n]+?)\s*-->/i,(function(e,n){return n.replace(/(?:^|,)\s*([^:,]+)\s*(?:\:\s*([^,\s]+))?/g,(function(e,n,a){return t[n]=!(void 0!==a&&a.length>0)||JSON.parse(a),""})),""}));var n,i=new a.default,o=new r.default(e,t),s=this.rules;for(var l in t)void 0!==(n=s[l])&&!1!==t[l]&&n.init(i,o,t[l]);return i.parse(e),o.messages},e.prototype.format=function(e,t){void 0===t&&(t={});var n=[],a={white:"",grey:"",red:"",reset:""};t.colors&&(a.white="[37m",a.grey="[90m",a.red="[31m",a.reset="[39m");var r=t.indent||0;return e.forEach((function(e){var t=e.evidence,o=e.line,s=e.col,l=t.length,u=s>41?s-40:1,d=t.length>s+60?s+60:l;s<41&&(d+=40-s+1),t=t.replace(/\t/g," ").substring(u-1,d),u>1&&(t="..."+t,u-=3),d<l&&(t+="..."),n.push(a.white+i(r)+"L"+o+" |"+a.grey+t+a.reset);var c=s-u,f=t.substring(0,c).match(/[^\u0000-\u00ff]/g);null!==f&&(c+=f.length),n.push(a.white+i(r)+i(String(o).length+3+c)+"^ "+a.red+e.message+" ("+e.rule.id+")"+a.reset)})),n},e}();function i(e,t){return new Array(e+1).join(t||" ")}t.HTMLHint=new n,Object.keys(D).forEach((function(e){t.HTMLHint.addRule(D[e])}))})))})); |
{ | ||
"name": "htmlhint", | ||
"version": "0.15.0", | ||
"version": "0.15.1", | ||
"description": "The Static Code Analysis Tool for your HTML", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
306141
3795