Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

htmlhint-invalid-attribute-rule

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

htmlhint-invalid-attribute-rule - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

7

dist/core/rules/attr-invalid.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const html_element_attributes_1 = require("html-element-attributes");
exports.default = {

@@ -7,6 +8,8 @@ id: 'attr-invalid',

init(parser, reporter) {
const commonAttributes = html_element_attributes_1.htmlElementAttributes['*'] || [];
parser.addListener('tagstart', (event) => {
const tagName = event.tagName.toLowerCase();
const attrs = event.attrs;
const validAttributesForTag = ['class'];
const specificAttributes = html_element_attributes_1.htmlElementAttributes[tagName] || [];
const validAttributesForTag = [...commonAttributes, ...specificAttributes];
for (const attr of attrs) {

@@ -20,2 +23,2 @@ if (!validAttributesForTag.includes(attr.name)) {

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ci1pbnZhbGlkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvcmUvcnVsZXMvYXR0ci1pbnZhbGlkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBR0Esa0JBQWU7SUFDYixFQUFFLEVBQUUsY0FBYztJQUNsQixXQUFXLEVBQUUsbURBQW1EO0lBQ2hFLElBQUksQ0FBQyxNQUFNLEVBQUUsUUFBUTtRQUduQixNQUFNLENBQUMsV0FBVyxDQUFDLFVBQVUsRUFBRSxDQUFDLEtBQUssRUFBRSxFQUFFO1lBQ3ZDLE1BQU0sT0FBTyxHQUFHLEtBQUssQ0FBQyxPQUFPLENBQUMsV0FBVyxFQUFFLENBQUE7WUFDM0MsTUFBTSxLQUFLLEdBQUcsS0FBSyxDQUFDLEtBQUssQ0FBQTtZQU96QixNQUFNLHFCQUFxQixHQUFHLENBQUMsT0FBTyxDQUFDLENBQUE7WUFFdkMsS0FBSyxNQUFNLElBQUksSUFBSSxLQUFLLEVBQUU7Z0JBQ3hCLElBQUksQ0FBQyxxQkFBcUIsQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxFQUFFO29CQUM5QyxRQUFRLENBQUMsS0FBSyxDQUNaLG1CQUFtQixJQUFJLENBQUMsSUFBSSxpQ0FBaUMsT0FBTyxLQUFLLEVBQ3pFLEtBQUssQ0FBQyxJQUFJLEVBQ1YsS0FBSyxDQUFDLEdBQUcsR0FBRyxLQUFLLENBQUMsT0FBTyxDQUFDLE1BQU0sR0FBRyxDQUFDLEdBQUcsSUFBSSxDQUFDLEtBQUssRUFDakQsSUFBSSxFQUNKLElBQUksQ0FBQyxHQUFHLENBQ1QsQ0FBQTtpQkFDRjthQUNGO1FBQ0gsQ0FBQyxDQUFDLENBQUE7SUFDSixDQUFDO0NBQ00sQ0FBQSJ9
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ci1pbnZhbGlkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvcmUvcnVsZXMvYXR0ci1pbnZhbGlkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EscUVBQStEO0FBRS9ELGtCQUFlO0lBQ2IsRUFBRSxFQUFFLGNBQWM7SUFDbEIsV0FBVyxFQUFFLG1EQUFtRDtJQUNoRSxJQUFJLENBQUMsTUFBTSxFQUFFLFFBQVE7UUFDbkIsTUFBTSxnQkFBZ0IsR0FBRywrQ0FBcUIsQ0FBQyxHQUFHLENBQUMsSUFBSSxFQUFFLENBQUE7UUFFekQsTUFBTSxDQUFDLFdBQVcsQ0FBQyxVQUFVLEVBQUUsQ0FBQyxLQUFLLEVBQUUsRUFBRTtZQUN2QyxNQUFNLE9BQU8sR0FBRyxLQUFLLENBQUMsT0FBTyxDQUFDLFdBQVcsRUFBRSxDQUFBO1lBQzNDLE1BQU0sS0FBSyxHQUFHLEtBQUssQ0FBQyxLQUFLLENBQUE7WUFHekIsTUFBTSxrQkFBa0IsR0FBRywrQ0FBcUIsQ0FBQyxPQUFPLENBQUMsSUFBSSxFQUFFLENBQUE7WUFFL0QsTUFBTSxxQkFBcUIsR0FBRyxDQUFDLEdBQUcsZ0JBQWdCLEVBQUUsR0FBRyxrQkFBa0IsQ0FBQyxDQUFBO1lBRTFFLEtBQUssTUFBTSxJQUFJLElBQUksS0FBSyxFQUFFO2dCQUN4QixJQUFJLENBQUMscUJBQXFCLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsRUFBRTtvQkFDOUMsUUFBUSxDQUFDLEtBQUssQ0FDWixtQkFBbUIsSUFBSSxDQUFDLElBQUksaUNBQWlDLE9BQU8sS0FBSyxFQUN6RSxLQUFLLENBQUMsSUFBSSxFQUNWLEtBQUssQ0FBQyxHQUFHLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQyxNQUFNLEdBQUcsQ0FBQyxHQUFHLElBQUksQ0FBQyxLQUFLLEVBQ2pELElBQUksRUFDSixJQUFJLENBQUMsR0FBRyxDQUNULENBQUE7aUJBQ0Y7YUFDRjtRQUNILENBQUMsQ0FBQyxDQUFBO0lBQ0osQ0FBQztDQUNNLENBQUEifQ==

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).HTMLHint=t()}(this,(function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t={},a={};Object.defineProperty(a,"__esModule",{value:!0});a.default=class{constructor(){this._listeners={},this._mapCdataTags=this.makeMap("script,style"),this._arrBlocks=[],this.lastEvent=null}makeMap(e){const t={},a=e.split(",");for(let e=0;e<a.length;e++)t[a[e]]=!0;return t}parse(e){const t=this._mapCdataTags,a=/<(?:\/([^\s>]+)\s*|!--([\s\S]*?)--|!([^>]*?)|([\w\-:]+)((?:\s+[^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]*))?)*?)\s*(\/?))>/g,r=/\s*([^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+)(?:\s*=\s*(?:(")([^"]*)"|(')([^']*)'|([^\s"'>]*)))?/g,n=/\r?\n/g;let s,i,l,o,d,u,c=0,f=null,g=[],h=0,p=0,m=1;const b=this._arrBlocks;this.fire("start",{pos:0,line:1,col:1});const v=()=>{const e=o.find((e=>"type"===e.name))||{value:""};return t[l]&&-1===e.value.indexOf("text/ng-template")},y=(e,t,a,r)=>{const s=a-p+1;for(void 0===r&&(r={}),r.raw=t,r.pos=a,r.line=m,r.col=s,b.push(r),this.fire(e,r);n.exec(t);)m++,p=a+n.lastIndex};for(;s=a.exec(e);)if(i=s.index,i>c&&(u=e.substring(c,i),f?g.push(u):y("text",u,c)),c=a.lastIndex,!(l=s[1])||(f&&l===f&&(u=g.join(""),y("cdata",u,h,{tagName:f,attrs:d}),f=null,d=void 0,g=[]),f))if(f)g.push(s[0]);else if(l=s[4]){o=[];const e=s[5];let t,a=0;for(;t=r.exec(e);){const e=t[1],r=t[2]?t[2]:t[4]?t[4]:"",n=t[3]?t[3]:t[5]?t[5]:t[6]?t[6]:"";o.push({name:e,value:n,quote:r,index:t.index,raw:t[0]}),a+=t[0].length}a===e.length?(y("tagstart",s[0],i,{tagName:l,attrs:o,close:s[6]}),v()&&(f=l,d=o.concat(),g=[],h=c)):y("text",s[0],i)}else(s[2]||s[3])&&y("comment",s[0],i,{content:s[2]||s[3],long:!!s[2]});else y("tagend",s[0],i,{tagName:l});e.length>c&&(u=e.substring(c,e.length),y("text",u,c)),this.fire("end",{pos:c,line:m,col:e.length-p+1})}addListener(e,t){const a=this._listeners,r=e.split(/[,\s]/);let n;for(let e=0,s=r.length;e<s;e++)n=r[e],void 0===a[n]&&(a[n]=[]),a[n].push(t)}fire(e,t){void 0===t&&(t={}),t.type=e;let a=[];const r=this._listeners[e],n=this._listeners.all;void 0!==r&&(a=a.concat(r)),void 0!==n&&(a=a.concat(n));const s=this.lastEvent;null!==s&&(delete s.lastEvent,t.lastEvent=s),this.lastEvent=t;for(let e=0,r=a.length;e<r;e++)a[e].call(this,t)}removeListener(e,t){const a=this._listeners[e];if(void 0!==a)for(let e=0,r=a.length;e<r;e++)if(a[e]===t){a.splice(e,1);break}}fixPos(e,t){const a=e.raw.substr(0,t).split(/\r?\n/),r=a.length-1;let n,s=e.line;return r>0?(s+=r,n=a[r].length+1):n=e.col+t,{line:s,col:n}}getMapAttrs(e){const t={};let a;for(let r=0,n=e.length;r<n;r++)a=e[r],t[a.name]=a.value;return t}};var r={};Object.defineProperty(r,"__esModule",{value:!0});r.default=class{constructor(e,t){this.html=e,this.lines=e.split(/\r?\n/);const a=/\r?\n/.exec(e);this.brLen=null!==a?a[0].length:0,this.ruleset=t,this.messages=[]}info(e,t,a,r,n){this.report("info",e,t,a,r,n)}warn(e,t,a,r,n){this.report("warning",e,t,a,r,n)}error(e,t,a,r,n){this.report("error",e,t,a,r,n)}report(e,t,a,r,n,s){const i=this.lines,l=this.brLen;let o="",d=0;for(let e=a-1,t=i.length;e<t&&(o=i[e],d=o.length,r>d&&a<t);e++)a++,1!==(r-=d)&&(r-=l);this.messages.push({type:e,message:t,raw:s,evidence:o,line:a,col:r,rule:{id:n.id,description:n.description,link:`https://htmlhint.com/docs/user-guide/rules/${n.id}`}})}};var n={},s={};Object.defineProperty(s,"__esModule",{value:!0}),s.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(e,t){e.addListener("tagstart",(a=>{const r=a.tagName.toLowerCase(),n=e.getMapAttrs(a.attrs),s=a.col+r.length+1;let i;"img"!==r||"alt"in n?("area"===r&&"href"in n||"input"===r&&"image"===n.type)&&("alt"in n&&""!==n.alt||(i="area"===r?"area[href]":"input[type=image]",t.warn(`The alt attribute of ${i} must have a value.`,a.line,s,this,a.raw))):t.warn("An alt attribute must be present on <img> elements.",a.line,s,this,a.raw)}))}};var i={};Object.defineProperty(i,"__esModule",{value:!0});const l=["allowReorder","attributeName","attributeType","autoReverse","baseFrequency","baseProfile","calcMode","clipPath","clipPathUnits","contentScriptType","contentStyleType","diffuseConstant","edgeMode","externalResourcesRequired","filterRes","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","onBlur","onChange","onClick","onFocus","onKeyUp","onLoad","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"];function o(e,t){if(t instanceof RegExp)return!!t.test(e)&&{match:e,pattern:t};const a=t[0],r=t[t.length-1],n=t[t.length-2],s="/"===a&&("/"===r||"/"===n&&"i"===r);if(s){return s&&"i"===r?new RegExp(t.slice(1,-2),"i").test(e):new RegExp(t.slice(1,-1)).test(e)}return e===t}i.default={id:"attr-lowercase",description:"All attribute names must be in lowercase.",init(e,t,a){const r=(Array.isArray(a)?a:[]).concat(l);e.addListener("tagstart",(e=>{const a=e.attrs;let n;const s=e.col+e.tagName.length+1;for(let i=0,l=a.length;i<l;i++){n=a[i];const l=n.name;r.find((e=>o(l,e)))||l===l.toLowerCase()||t.error(`The attribute name of [ ${l} ] must be in lowercase.`,e.line,s+n.index,this,n.raw)}}))}};var d={};Object.defineProperty(d,"__esModule",{value:!0}),d.default={id:"attr-sorted",description:"Attribute tags must be in proper order.",init(e,t){const a={},r=["class","id","name","src","for","type","href","value","title","alt","role"];for(let e=0;e<r.length;e++)a[r[e]]=e;e.addListener("tagstart",(e=>{const r=e.attrs,n=[];for(let e=0;e<r.length;e++)n.push(r[e].name);const s=JSON.stringify(n);n.sort(((e,t)=>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(n)&&t.error(`Inaccurate order ${s} should be in hierarchy ${JSON.stringify(n)} `,e.line,e.col,this,e.raw)}))}};var u={};Object.defineProperty(u,"__esModule",{value:!0}),u.default={id:"attr-no-duplication",description:"Elements cannot have duplicate attributes.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r,n;const s=e.col+e.tagName.length+1,i={};for(let l=0,o=a.length;l<o;l++)r=a[l],n=r.name,!0===i[n]&&t.error(`Duplicate of attribute name [ ${r.name} ] was found.`,e.line,s+r.index,this,r.raw),i[n]=!0}))}};var c={};Object.defineProperty(c,"__esModule",{value:!0}),c.default={id:"attr-unsafe-chars",description:"Attribute values cannot contain unsafe chars.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=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]/;let i;for(let l=0,o=a.length;l<o;l++)if(r=a[l],i=s.exec(r.value),null!==i){const a=escape(i[0]).replace(/%u/,"\\u").replace(/%/,"\\x");t.warn(`The value of attribute [ ${r.name} ] cannot contain an unsafe char [ ${a} ].`,e.line,n+r.index,this,r.raw)}}))}};var f={};Object.defineProperty(f,"__esModule",{value:!0}),f.default={id:"attr-value-double-quotes",description:"Attribute values must be in double quotes.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let s=0,i=a.length;s<i;s++)r=a[s],(""!==r.value&&'"'!==r.quote||""===r.value&&"'"===r.quote)&&t.error(`The value of attribute [ ${r.name} ] must be in double quotes.`,e.line,n+r.index,this,r.raw)}))}};var g={};Object.defineProperty(g,"__esModule",{value:!0}),g.default={id:"attr-value-not-empty",description:"All attributes must have values.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let s=0,i=a.length;s<i;s++)r=a[s],""===r.quote&&""===r.value&&t.warn(`The attribute [ ${r.name} ] must have a value.`,e.line,n+r.index,this,r.raw)}))}};var h={};Object.defineProperty(h,"__esModule",{value:!0}),h.default={id:"attr-value-single-quotes",description:"Attribute values must be in single quotes.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let s=0,i=a.length;s<i;s++)r=a[s],(""!==r.value&&"'"!==r.quote||""===r.value&&'"'===r.quote)&&t.error(`The value of attribute [ ${r.name} ] must be in single quotes.`,e.line,n+r.index,this,r.raw)}))}};var p={};Object.defineProperty(p,"__esModule",{value:!0}),p.default={id:"attr-whitespace",description:"All attributes should be separated by only one space and not have leading/trailing whitespace.",init(e,t,a){const r=Array.isArray(a)?a:[];e.addListener("tagstart",(e=>{const a=e.attrs;let n;const s=e.col+e.tagName.length+1;a.forEach((a=>{n=a;const i=a.name;-1===r.indexOf(i)&&(a.value.trim()!==a.value&&t.error(`The attributes of [ ${i} ] must not have leading or trailing whitespace.`,e.line,s+n.index,this,n.raw),a.value.replace(/ +(?= )/g,"")!==a.value&&t.error(`The attributes of [ ${i} ] must be separated by only one space.`,e.line,s+n.index,this,n.raw))}))}))}};var m={};Object.defineProperty(m,"__esModule",{value:!0}),m.default={id:"doctype-first",description:"Doctype must be declared first.",init(e,t){const a=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,this,r.raw),e.removeListener("all",a))};e.addListener("all",a)}};var b={};Object.defineProperty(b,"__esModule",{value:!0}),b.default={id:"doctype-html5",description:'Invalid doctype. Use: "<!DOCTYPE html>"',init(e,t){const a=e=>{!1===e.long&&"doctype html"!==e.content.toLowerCase()&&t.warn('Invalid doctype. Use: "<!DOCTYPE html>"',e.line,e.col,this,e.raw)},r=()=>{e.removeListener("comment",a),e.removeListener("tagstart",r)};e.addListener("all",a),e.addListener("tagstart",r)}};var v={};Object.defineProperty(v,"__esModule",{value:!0}),v.default={id:"head-script-disabled",description:"The <script> tag cannot be used in a <head> tag.",init(e,t){const a=/^(text\/javascript|application\/javascript)$/i;let r=!1;const n=n=>{const s=e.getMapAttrs(n.attrs).type,i=n.tagName.toLowerCase();"head"===i&&(r=!0),!0!==r||"script"!==i||s&&!0!==a.test(s)||t.warn("The <script> tag cannot be used in a <head> tag.",n.line,n.col,this,n.raw)},s=t=>{"head"===t.tagName.toLowerCase()&&(e.removeListener("tagstart",n),e.removeListener("tagend",s))};e.addListener("tagstart",n),e.addListener("tagend",s)}};var y={};Object.defineProperty(y,"__esModule",{value:!0}),y.default={id:"href-abs-or-rel",description:"An href attribute must be either absolute or relative.",init(e,t,a){const r="abs"===a?"absolute":"relative";e.addListener("tagstart",(e=>{const a=e.attrs;let n;const s=e.col+e.tagName.length+1;for(let i=0,l=a.length;i<l;i++)if(n=a[i],"href"===n.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,s+n.index,this,n.raw);break}}))}};var w={};Object.defineProperty(w,"__esModule",{value:!0});w.default={id:"html-lang-require",description:"The lang attribute of an <html> element must be present and should be valid.",init(e,t){e.addListener("tagstart",(a=>{const r=a.tagName.toLowerCase(),n=e.getMapAttrs(a.attrs),s=a.col+r.length+1,i=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 n?n.lang?i.test(n.lang)||t.warn("The lang attribute value of <html> element must be a valid BCP47.",a.line,s,this,a.raw):t.warn("The lang attribute of <html> element must have a value.",a.line,s,this,a.raw):t.warn("An lang attribute must be present on <html> elements.",a.line,s,this,a.raw))}))}};var L={};Object.defineProperty(L,"__esModule",{value:!0}),L.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(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r,n;const s=e.col+e.tagName.length+1;for(let i=0,l=a.length;i<l;i++)r=a[i],n=r.name,/^(id|class)$/i.test(n)&&/(^|[-_])ad([-_]|$)/i.test(r.value)&&t.warn(`The value of attribute ${n} cannot use the ad keyword.`,e.line,s+r.index,this,r.raw)}))}};var O={};Object.defineProperty(O,"__esModule",{value:!0}),O.default={id:"id-class-value",description:"The id and class attribute values must meet the specified rules.",init(e,t,a){let r;if(r="string"==typeof a?{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."}}[a]:a,"object"==typeof r&&r.regId){let a=r.regId;const n=r.message;a instanceof RegExp||(a=new RegExp(a)),e.addListener("tagstart",(e=>{const r=e.attrs;let s;const i=e.col+e.tagName.length+1;for(let l=0,o=r.length;l<o;l++)if(s=r[l],"id"===s.name.toLowerCase()&&!1===a.test(s.value)&&t.warn(n,e.line,i+s.index,this,s.raw),"class"===s.name.toLowerCase()){const r=s.value.split(/\s+/g);let l;for(let o=0,d=r.length;o<d;o++)l=r[o],l&&!1===a.test(l)&&t.warn(n,e.line,i+s.index,this,l)}}))}}};var x={};Object.defineProperty(x,"__esModule",{value:!0}),x.default={id:"id-unique",description:"The value of id attributes must be unique.",init(e,t){const a={};e.addListener("tagstart",(e=>{const r=e.attrs;let n,s;const i=e.col+e.tagName.length+1;for(let l=0,o=r.length;l<o;l++)if(n=r[l],"id"===n.name.toLowerCase()){s=n.value,s&&(void 0===a[s]?a[s]=1:a[s]++,a[s]>1&&t.error(`The id value [ ${s} ] must be unique.`,e.line,i+n.index,this,n.raw));break}}))}};var j={};Object.defineProperty(j,"__esModule",{value:!0}),j.default={id:"inline-script-disabled",description:"Inline script cannot be used.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;let s;const i=/^on(unload|message|submit|select|scroll|resize|mouseover|mouseout|mousemove|mouseleave|mouseenter|mousedown|load|keyup|keypress|keydown|focus|dblclick|click|change|blur|error)$/i;for(let l=0,o=a.length;l<o;l++)r=a[l],s=r.name.toLowerCase(),!0===i.test(s)?t.warn(`Inline script [ ${r.raw} ] cannot be used.`,e.line,n+r.index,this,r.raw):"src"!==s&&"href"!==s||/^\s*javascript:/i.test(r.value)&&t.warn(`Inline script [ ${r.raw} ] cannot be used.`,e.line,n+r.index,this,r.raw)}))}};var P={};Object.defineProperty(P,"__esModule",{value:!0}),P.default={id:"inline-style-disabled",description:"Inline style cannot be used.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let s=0,i=a.length;s<i;s++)r=a[s],"style"===r.name.toLowerCase()&&t.warn(`Inline style [ ${r.raw} ] cannot be used.`,e.line,n+r.index,this,r.raw)}))}};var _={};Object.defineProperty(_,"__esModule",{value:!0}),_.default={id:"input-requires-label",description:"All [ input ] tags must have a corresponding [ label ] tag. ",init(e,t){const a=[],r=[];e.addListener("tagstart",(t=>{const n=t.tagName.toLowerCase(),s=e.getMapAttrs(t.attrs),i=t.col+n.length+1;"input"===n&&"hidden"!==s.type&&r.push({event:t,col:i,id:s.id}),"label"===n&&"for"in s&&""!==s.for&&a.push({event:t,col:i,forValue:s.for})})),e.addListener("end",(()=>{r.forEach((e=>{(function(e){let t=!1;return a.forEach((a=>{e.id&&e.id===a.forValue&&(t=!0)})),t})(e)||t.warn("No matching [ label ] tag found.",e.event.line,e.col,this,e.event.raw)}))}))}};var T={};Object.defineProperty(T,"__esModule",{value:!0}),T.default={id:"script-disabled",description:"The <script> tag cannot be used.",init(e,t){e.addListener("tagstart",(e=>{"script"===e.tagName.toLowerCase()&&t.error("The <script> tag cannot be used.",e.line,e.col,this,e.raw)}))}};var $={};Object.defineProperty($,"__esModule",{value:!0}),$.default={id:"space-tab-mixed-disabled",description:"Do not mix tabs and spaces for indentation.",init(e,t,a){let r="nomix",n=null;if("string"==typeof a){const e=/^([a-z]+)(\d+)?/.exec(a);e&&(r=e[1],n=e[2]&&parseInt(e[2],10))}e.addListener("text",(a=>{const s=a.raw,i=/(^|\r?\n)([ \t]+)/g;let l;for(;l=i.exec(s);){const s=e.fixPos(a,l.index+l[1].length);if(1!==s.col)continue;const i=l[2];"space"===r?n?!1!==/^ +$/.test(i)&&i.length%n==0||t.warn(`Please use space for indentation and keep ${n} length.`,s.line,1,this,a.raw):!1===/^ +$/.test(i)&&t.warn("Please use space for indentation.",s.line,1,this,a.raw):"tab"===r&&!1===/^\t+$/.test(i)?t.warn("Please use tab for indentation.",s.line,1,this,a.raw):!0===/ +\t|\t+ /.test(i)&&t.warn("Do not mix tabs and spaces for indentation.",s.line,1,this,a.raw)}}))}};var A={};Object.defineProperty(A,"__esModule",{value:!0}),A.default={id:"spec-char-escape",description:"Special characters must be escaped.",init(e,t){e.addListener("text",(a=>{const r=a.raw,n=/([<>])|( \& )/g;let s;for(;s=n.exec(r);){const r=e.fixPos(a,s.index);t.error(`Special characters must be escaped : [ ${s[0]} ].`,r.line,r.col,this,a.raw)}}))}};var M={};Object.defineProperty(M,"__esModule",{value:!0}),M.default={id:"src-not-empty",description:"The src attribute of an img(script,link) must have a value.",init(e,t){e.addListener("tagstart",(e=>{const a=e.tagName,r=e.attrs;let n;const s=e.col+a.length+1;for(let i=0,l=r.length;i<l;i++)n=r[i],(!0===/^(img|script|embed|bgsound|iframe)$/.test(a)&&"src"===n.name||"link"===a&&"href"===n.name||"object"===a&&"data"===n.name)&&""===n.value&&t.error(`The attribute [ ${n.name} ] of the tag [ ${a} ] must have a value.`,e.line,s+n.index,this,n.raw)}))}};var N={};Object.defineProperty(N,"__esModule",{value:!0}),N.default={id:"style-disabled",description:"<style> tags cannot be used.",init(e,t){e.addListener("tagstart",(e=>{"style"===e.tagName.toLowerCase()&&t.warn("The <style> tag cannot be used.",e.line,e.col,this,e.raw)}))}};var k={};Object.defineProperty(k,"__esModule",{value:!0}),k.default={id:"tag-pair",description:"Tag must be paired.",init(e,t){const 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",(e=>{const t=e.tagName.toLowerCase();void 0!==r[t]||e.close||a.push({tagName:t,line:e.line,raw:e.raw})})),e.addListener("tagend",(e=>{const r=e.tagName.toLowerCase();let n;for(n=a.length-1;n>=0&&a[n].tagName!==r;n--);if(n>=0){const r=[];for(let e=a.length-1;e>n;e--)r.push(`</${a[e].tagName}>`);if(r.length>0){const n=a[a.length-1];t.error(`Tag must be paired, missing: [ ${r.join("")} ], start tag match failed [ ${n.raw} ] on line ${n.line}.`,e.line,e.col,this,e.raw)}a.length=n}else t.error(`Tag must be paired, no start tag: [ ${e.raw} ]`,e.line,e.col,this,e.raw)})),e.addListener("end",(e=>{const r=[];for(let e=a.length-1;e>=0;e--)r.push(`</${a[e].tagName}>`);if(r.length>0){const n=a[a.length-1];t.error(`Tag must be paired, missing: [ ${r.join("")} ], open tag match failed [ ${n.raw} ] on line ${n.line}.`,e.line,e.col,this,"")}}))}};var C={};Object.defineProperty(C,"__esModule",{value:!0}),C.default={id:"tag-self-close",description:"Empty tags must be self closed.",init(e,t){const a=e.makeMap("area,base,basefont,bgsound,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(e=>{const r=e.tagName.toLowerCase();void 0!==a[r]&&(e.close||t.warn(`The empty tag : [ ${r} ] must be self closed.`,e.line,e.col,this,e.raw))}))}};var q={};Object.defineProperty(q,"__esModule",{value:!0}),q.default={id:"empty-tag-not-self-closed",description:"Empty tags must not use self closed syntax.",init(e,t){const a=e.makeMap("area,base,basefont,bgsound,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(e=>{const r=e.tagName.toLowerCase();void 0!==a[r]&&e.close&&t.error(`The empty tag : [ ${r} ] must not use self closed syntax.`,e.line,e.col,this,e.raw)}))}};var E={};Object.defineProperty(E,"__esModule",{value:!0}),E.default={id:"tagname-lowercase",description:"All html element names must be in lowercase.",init(e,t,a){const r=Array.isArray(a)?a:[];e.addListener("tagstart,tagend",(e=>{const a=e.tagName;-1===r.indexOf(a)&&a!==a.toLowerCase()&&t.error(`The html element name of [ ${a} ] must be in lowercase.`,e.line,e.col,this,e.raw)}))}};var R={};Object.defineProperty(R,"__esModule",{value:!0}),R.default={id:"tagname-specialchars",description:"All special characters must be escaped.",init(e,t){const a=/[^a-zA-Z0-9\-:_]/;e.addListener("tagstart,tagend",(e=>{const r=e.tagName;a.test(r)&&t.error(`The html element name of [ ${r} ] contains special character.`,e.line,e.col,this,e.raw)}))}};var S={};Object.defineProperty(S,"__esModule",{value:!0}),S.default={id:"title-require",description:"<title> must be present in <head> tag.",init(e,t){let a=!1,r=!1;const n=e=>{const t=e.tagName.toLowerCase();"head"===t?a=!0:"title"===t&&a&&(r=!0)},s=a=>{const i=a.tagName.toLowerCase();if(r&&"title"===i){const e=a.lastEvent;("text"!==e.type||"text"===e.type&&!0===/^\s*$/.test(e.raw))&&t.error("<title></title> must not be empty.",a.line,a.col,this,a.raw)}else"head"===i&&(!1===r&&t.error("<title> must be present in <head> tag.",a.line,a.col,this,a.raw),e.removeListener("tagstart",n),e.removeListener("tagend",s))};e.addListener("tagstart",n),e.addListener("tagend",s)}};var z={};Object.defineProperty(z,"__esModule",{value:!0});let D={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"]}};z.default={id:"tags-check",description:"Checks html tags.",init(e,t,a){D=Object.assign(Object.assign({},D),a),e.addListener("tagstart",(e=>{const a=e.attrs,r=e.col+e.tagName.length+1,n=e.tagName.toLowerCase();if(D[n]){const s=D[n];if(!0!==s.selfclosing||e.close?!1===s.selfclosing&&e.close&&t.warn(`The <${n}> tag must not be selfclosing.`,e.line,e.col,this,e.raw):t.warn(`The <${n}> tag must be selfclosing.`,e.line,e.col,this,e.raw),Array.isArray(s.attrsRequired)){s.attrsRequired.forEach((s=>{if(Array.isArray(s)){const i=s.map((e=>e)),l=i.shift(),o=i;a.some((e=>e.name===l))?a.forEach((a=>{a.name===l&&-1===o.indexOf(a.value)&&t.error(`The <${n}> tag must have attr '${l}' with one value of '${o.join("' or '")}'.`,e.line,r,this,e.raw)})):t.error(`The <${n}> tag must have attr '${l}'.`,e.line,r,this,e.raw)}else a.some((e=>-1!==s.split("|").indexOf(e.name)))||t.error(`The <${n}> tag must have attr '${s}'.`,e.line,r,this,e.raw)}))}if(Array.isArray(s.attrsOptional)){s.attrsOptional.forEach((s=>{if(Array.isArray(s)){const i=s.map((e=>e)),l=i.shift(),o=i;a.some((e=>e.name===l))&&a.forEach((a=>{a.name===l&&-1===o.indexOf(a.value)&&t.error(`The <${n}> tag must have optional attr '${l}' with one value of '${o.join("' or '")}'.`,e.line,r,this,e.raw)}))}}))}if(Array.isArray(s.redundantAttrs)){s.redundantAttrs.forEach((s=>{a.some((e=>e.name===s))&&t.error(`The attr '${s}' is redundant for <${n}> and should be omitted.`,e.line,r,this,e.raw)}))}}}))}};var U={};Object.defineProperty(U,"__esModule",{value:!0}),U.default={id:"attr-no-unnecessary-whitespace",description:"No spaces between attribute names and values.",init(e,t,a){const r=Array.isArray(a)?a:[];e.addListener("tagstart",(e=>{const a=e.attrs,n=e.col+e.tagName.length+1;for(let s=0;s<a.length;s++)if(-1===r.indexOf(a[s].name)){const r=/(\s*)=(\s*)/.exec(a[s].raw.trim());!r||0===r[1].length&&0===r[2].length||t.error(`The attribute '${a[s].name}' must not have spaces between the name and value.`,e.line,n+a[s].index,this,a[s].raw)}}))}};var H={};Object.defineProperty(H,"__esModule",{value:!0}),H.default={id:"attr-invalid",description:"Attributes must be valid for the given HTML tags.",init(e,t){e.addListener("tagstart",(e=>{const a=e.tagName.toLowerCase(),r=e.attrs,n=["class"];for(const s of r)n.includes(s.name)||t.error(`The attribute [ ${s.name} ] is not valid for the tag [ ${a} ].`,e.line,e.col+e.tagName.length+1+s.index,this,s.raw)}))}};var I={};Object.defineProperty(I,"__esModule",{value:!0});const Z=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"];return I.default={id:"invalid-tag",description:"All tags must be valid HTML tags.",init(e,t){const a=[];e.addListener("tagstart",(e=>{const r=e.tagName;Z.includes(r)?a.push(r):t.error(`The tag [ ${r} ] is not a valid HTML tag.`,e.line,e.col,this,e.raw)})),e.addListener("tagend",(e=>{const r=e.tagName;if(Z.includes(r)){const e=a.lastIndexOf(r);-1!==e&&a.splice(e,1)}else t.error(`The closing tag [ ${r} ] is not a valid HTML tag.`,e.line,e.col,this,e.raw)})),e.addListener("end",(()=>{a.forEach((e=>{t.error(`The tag [ ${e} ] was opened but never closed.`,0,0,this,"")}))}))}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.invalidTag=e.attrInvalid=e.attrNoUnnecessaryWhitespace=e.tagsCheck=e.titleRequire=e.tagnameSpecialChars=e.tagnameLowercase=e.emptyTagNotSelfClosed=e.tagSelfClose=e.tagPair=e.styleDisabled=e.srcNotEmpty=e.specCharEscape=e.spaceTabMixedDisabled=e.scriptDisabled=e.inputRequiresLabel=e.inlineStyleDisabled=e.inlineScriptDisabled=e.idUnique=e.idClassValue=e.idClsasAdDisabled=e.htmlLangRequire=e.hrefAbsOrRel=e.headScriptDisabled=e.doctypeHTML5=e.doctypeFirst=e.attrWhitespace=e.attrValueSingleQuotes=e.attrValueNotEmpty=e.attrValueDoubleQuotes=e.attrUnsafeChars=e.attrNoDuplication=e.attrSort=e.attrLowercase=e.altRequire=void 0;var t=s;Object.defineProperty(e,"altRequire",{enumerable:!0,get:function(){return t.default}});var a=i;Object.defineProperty(e,"attrLowercase",{enumerable:!0,get:function(){return a.default}});var r=d;Object.defineProperty(e,"attrSort",{enumerable:!0,get:function(){return r.default}});var n=u;Object.defineProperty(e,"attrNoDuplication",{enumerable:!0,get:function(){return n.default}});var l=c;Object.defineProperty(e,"attrUnsafeChars",{enumerable:!0,get:function(){return l.default}});var o=f;Object.defineProperty(e,"attrValueDoubleQuotes",{enumerable:!0,get:function(){return o.default}});var D=g;Object.defineProperty(e,"attrValueNotEmpty",{enumerable:!0,get:function(){return D.default}});var Z=h;Object.defineProperty(e,"attrValueSingleQuotes",{enumerable:!0,get:function(){return Z.default}});var F=p;Object.defineProperty(e,"attrWhitespace",{enumerable:!0,get:function(){return F.default}});var V=m;Object.defineProperty(e,"doctypeFirst",{enumerable:!0,get:function(){return V.default}});var B=b;Object.defineProperty(e,"doctypeHTML5",{enumerable:!0,get:function(){return B.default}});var Y=v;Object.defineProperty(e,"headScriptDisabled",{enumerable:!0,get:function(){return Y.default}});var W=y;Object.defineProperty(e,"hrefAbsOrRel",{enumerable:!0,get:function(){return W.default}});var J=w;Object.defineProperty(e,"htmlLangRequire",{enumerable:!0,get:function(){return J.default}});var Q=L;Object.defineProperty(e,"idClsasAdDisabled",{enumerable:!0,get:function(){return Q.default}});var X=O;Object.defineProperty(e,"idClassValue",{enumerable:!0,get:function(){return X.default}});var G=x;Object.defineProperty(e,"idUnique",{enumerable:!0,get:function(){return G.default}});var K=j;Object.defineProperty(e,"inlineScriptDisabled",{enumerable:!0,get:function(){return K.default}});var ee=P;Object.defineProperty(e,"inlineStyleDisabled",{enumerable:!0,get:function(){return ee.default}});var te=_;Object.defineProperty(e,"inputRequiresLabel",{enumerable:!0,get:function(){return te.default}});var ae=T;Object.defineProperty(e,"scriptDisabled",{enumerable:!0,get:function(){return ae.default}});var re=$;Object.defineProperty(e,"spaceTabMixedDisabled",{enumerable:!0,get:function(){return re.default}});var ne=A;Object.defineProperty(e,"specCharEscape",{enumerable:!0,get:function(){return ne.default}});var se=M;Object.defineProperty(e,"srcNotEmpty",{enumerable:!0,get:function(){return se.default}});var ie=N;Object.defineProperty(e,"styleDisabled",{enumerable:!0,get:function(){return ie.default}});var le=k;Object.defineProperty(e,"tagPair",{enumerable:!0,get:function(){return le.default}});var oe=C;Object.defineProperty(e,"tagSelfClose",{enumerable:!0,get:function(){return oe.default}});var de=q;Object.defineProperty(e,"emptyTagNotSelfClosed",{enumerable:!0,get:function(){return de.default}});var ue=E;Object.defineProperty(e,"tagnameLowercase",{enumerable:!0,get:function(){return ue.default}});var ce=R;Object.defineProperty(e,"tagnameSpecialChars",{enumerable:!0,get:function(){return ce.default}});var fe=S;Object.defineProperty(e,"titleRequire",{enumerable:!0,get:function(){return fe.default}});var ge=z;Object.defineProperty(e,"tagsCheck",{enumerable:!0,get:function(){return ge.default}});var he=U;Object.defineProperty(e,"attrNoUnnecessaryWhitespace",{enumerable:!0,get:function(){return he.default}});var pe=H;Object.defineProperty(e,"attrInvalid",{enumerable:!0,get:function(){return pe.default}});var me=I;Object.defineProperty(e,"invalidTag",{enumerable:!0,get:function(){return me.default}})}(n),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLParser=e.Reporter=e.HTMLRules=e.HTMLHint=void 0;const t=a;e.HTMLParser=t.default;const s=r;e.Reporter=s.default;const i=n;e.HTMLRules=i;function l(e,t){return new Array(e+1).join(t||" ")}e.HTMLHint=new class{constructor(){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}}addRule(e){this.rules[e.id]=e}verify(e,a=this.defaultRuleset){0===Object.keys(a).length&&(a=this.defaultRuleset),e=e.replace(/^\s*<!--\s*htmlhint\s+([^\r\n]+?)\s*-->/i,((e,t)=>(t.replace(/(?:^|,)\s*([^:,]+)\s*(?:\:\s*([^,\s]+))?/g,((e,t,r)=>(a[t]=!(void 0!==r&&r.length>0)||JSON.parse(r),""))),"")));const r=new t.default,n=new s.default(e,a),i=this.rules;let l;for(const e in a)l=i[e],void 0!==l&&!1!==a[e]&&l.init(r,n,a[e]);return r.parse(e),n.messages}format(e,t={}){const a=[],r={white:"",grey:"",red:"",reset:""};t.colors&&(r.white="",r.grey="",r.red="",r.reset="");const n=t.indent||0;return e.forEach((e=>{let t=e.evidence;const s=e.line,i=e.col,o=t.length;let d=i>41?i-40:1,u=t.length>i+60?i+60:o;i<41&&(u+=40-i+1),t=t.replace(/\t/g," ").substring(d-1,u),d>1&&(t=`...${t}`,d-=3),u<o&&(t+="..."),a.push(`${r.white+l(n)}L${s} |${r.grey}${t}${r.reset}`);let c=i-d;const f=t.substring(0,c).match(/[^\u0000-\u00ff]/g);null!==f&&(c+=f.length),a.push(`${r.white+l(n)+l(String(s).length+3+c)}^ ${r.red}${e.message} (${e.rule.id})${r.reset}`)})),a}},Object.keys(i).forEach((t=>{e.HTMLHint.addRule(i[t])}))}(t),e(t)}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).HTMLHint=t()}(this,(function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})})),t}var a={},r={};Object.defineProperty(r,"__esModule",{value:!0});r.default=class{constructor(){this._listeners={},this._mapCdataTags=this.makeMap("script,style"),this._arrBlocks=[],this.lastEvent=null}makeMap(e){const t={},a=e.split(",");for(let e=0;e<a.length;e++)t[a[e]]=!0;return t}parse(e){const t=this._mapCdataTags,a=/<(?:\/([^\s>]+)\s*|!--([\s\S]*?)--|!([^>]*?)|([\w\-:]+)((?:\s+[^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]*))?)*?)\s*(\/?))>/g,r=/\s*([^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+)(?:\s*=\s*(?:(")([^"]*)"|(')([^']*)'|([^\s"'>]*)))?/g,n=/\r?\n/g;let i,s,l,o,d,c,u=0,g=null,f=[],p=0,h=0,m=1;const b=this._arrBlocks;this.fire("start",{pos:0,line:1,col:1});const v=()=>{const e=o.find((e=>"type"===e.name))||{value:""};return t[l]&&-1===e.value.indexOf("text/ng-template")},y=(e,t,a,r)=>{const i=a-h+1;for(void 0===r&&(r={}),r.raw=t,r.pos=a,r.line=m,r.col=i,b.push(r),this.fire(e,r);n.exec(t);)m++,h=a+n.lastIndex};for(;i=a.exec(e);)if(s=i.index,s>u&&(c=e.substring(u,s),g?f.push(c):y("text",c,u)),u=a.lastIndex,!(l=i[1])||(g&&l===g&&(c=f.join(""),y("cdata",c,p,{tagName:g,attrs:d}),g=null,d=void 0,f=[]),g))if(g)f.push(i[0]);else if(l=i[4]){o=[];const e=i[5];let t,a=0;for(;t=r.exec(e);){const e=t[1],r=t[2]?t[2]:t[4]?t[4]:"",n=t[3]?t[3]:t[5]?t[5]:t[6]?t[6]:"";o.push({name:e,value:n,quote:r,index:t.index,raw:t[0]}),a+=t[0].length}a===e.length?(y("tagstart",i[0],s,{tagName:l,attrs:o,close:i[6]}),v()&&(g=l,d=o.concat(),f=[],p=u)):y("text",i[0],s)}else(i[2]||i[3])&&y("comment",i[0],s,{content:i[2]||i[3],long:!!i[2]});else y("tagend",i[0],s,{tagName:l});e.length>u&&(c=e.substring(u,e.length),y("text",c,u)),this.fire("end",{pos:u,line:m,col:e.length-h+1})}addListener(e,t){const a=this._listeners,r=e.split(/[,\s]/);let n;for(let e=0,i=r.length;e<i;e++)n=r[e],void 0===a[n]&&(a[n]=[]),a[n].push(t)}fire(e,t){void 0===t&&(t={}),t.type=e;let a=[];const r=this._listeners[e],n=this._listeners.all;void 0!==r&&(a=a.concat(r)),void 0!==n&&(a=a.concat(n));const i=this.lastEvent;null!==i&&(delete i.lastEvent,t.lastEvent=i),this.lastEvent=t;for(let e=0,r=a.length;e<r;e++)a[e].call(this,t)}removeListener(e,t){const a=this._listeners[e];if(void 0!==a)for(let e=0,r=a.length;e<r;e++)if(a[e]===t){a.splice(e,1);break}}fixPos(e,t){const a=e.raw.substr(0,t).split(/\r?\n/),r=a.length-1;let n,i=e.line;return r>0?(i+=r,n=a[r].length+1):n=e.col+t,{line:i,col:n}}getMapAttrs(e){const t={};let a;for(let r=0,n=e.length;r<n;r++)a=e[r],t[a.name]=a.value;return t}};var n={};Object.defineProperty(n,"__esModule",{value:!0});n.default=class{constructor(e,t){this.html=e,this.lines=e.split(/\r?\n/);const a=/\r?\n/.exec(e);this.brLen=null!==a?a[0].length:0,this.ruleset=t,this.messages=[]}info(e,t,a,r,n){this.report("info",e,t,a,r,n)}warn(e,t,a,r,n){this.report("warning",e,t,a,r,n)}error(e,t,a,r,n){this.report("error",e,t,a,r,n)}report(e,t,a,r,n,i){const s=this.lines,l=this.brLen;let o="",d=0;for(let e=a-1,t=s.length;e<t&&(o=s[e],d=o.length,r>d&&a<t);e++)a++,1!==(r-=d)&&(r-=l);this.messages.push({type:e,message:t,raw:i,evidence:o,line:a,col:r,rule:{id:n.id,description:n.description,link:`https://htmlhint.com/docs/user-guide/rules/${n.id}`}})}};var i={},s={};Object.defineProperty(s,"__esModule",{value:!0}),s.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(e,t){e.addListener("tagstart",(a=>{const r=a.tagName.toLowerCase(),n=e.getMapAttrs(a.attrs),i=a.col+r.length+1;let s;"img"!==r||"alt"in n?("area"===r&&"href"in n||"input"===r&&"image"===n.type)&&("alt"in n&&""!==n.alt||(s="area"===r?"area[href]":"input[type=image]",t.warn(`The alt attribute of ${s} must have a value.`,a.line,i,this,a.raw))):t.warn("An alt attribute must be present on <img> elements.",a.line,i,this,a.raw)}))}};var l={};Object.defineProperty(l,"__esModule",{value:!0});const o=["allowReorder","attributeName","attributeType","autoReverse","baseFrequency","baseProfile","calcMode","clipPath","clipPathUnits","contentScriptType","contentStyleType","diffuseConstant","edgeMode","externalResourcesRequired","filterRes","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","onBlur","onChange","onClick","onFocus","onKeyUp","onLoad","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"];function d(e,t){if(t instanceof RegExp)return!!t.test(e)&&{match:e,pattern:t};const a=t[0],r=t[t.length-1],n=t[t.length-2],i="/"===a&&("/"===r||"/"===n&&"i"===r);if(i){return i&&"i"===r?new RegExp(t.slice(1,-2),"i").test(e):new RegExp(t.slice(1,-1)).test(e)}return e===t}l.default={id:"attr-lowercase",description:"All attribute names must be in lowercase.",init(e,t,a){const r=(Array.isArray(a)?a:[]).concat(o);e.addListener("tagstart",(e=>{const a=e.attrs;let n;const i=e.col+e.tagName.length+1;for(let s=0,l=a.length;s<l;s++){n=a[s];const l=n.name;r.find((e=>d(l,e)))||l===l.toLowerCase()||t.error(`The attribute name of [ ${l} ] must be in lowercase.`,e.line,i+n.index,this,n.raw)}}))}};var c={};Object.defineProperty(c,"__esModule",{value:!0}),c.default={id:"attr-sorted",description:"Attribute tags must be in proper order.",init(e,t){const a={},r=["class","id","name","src","for","type","href","value","title","alt","role"];for(let e=0;e<r.length;e++)a[r[e]]=e;e.addListener("tagstart",(e=>{const r=e.attrs,n=[];for(let e=0;e<r.length;e++)n.push(r[e].name);const i=JSON.stringify(n);n.sort(((e,t)=>null==a[e]&&null==a[t]?0:null==a[e]?1:null==a[t]?-1:a[e]-a[t]||e.localeCompare(t))),i!==JSON.stringify(n)&&t.error(`Inaccurate order ${i} should be in hierarchy ${JSON.stringify(n)} `,e.line,e.col,this,e.raw)}))}};var u={};Object.defineProperty(u,"__esModule",{value:!0}),u.default={id:"attr-no-duplication",description:"Elements cannot have duplicate attributes.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r,n;const i=e.col+e.tagName.length+1,s={};for(let l=0,o=a.length;l<o;l++)r=a[l],n=r.name,!0===s[n]&&t.error(`Duplicate of attribute name [ ${r.name} ] was found.`,e.line,i+r.index,this,r.raw),s[n]=!0}))}};var g={};Object.defineProperty(g,"__esModule",{value:!0}),g.default={id:"attr-unsafe-chars",description:"Attribute values cannot contain unsafe chars.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1,i=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;let s;for(let l=0,o=a.length;l<o;l++)if(r=a[l],s=i.exec(r.value),null!==s){const a=escape(s[0]).replace(/%u/,"\\u").replace(/%/,"\\x");t.warn(`The value of attribute [ ${r.name} ] cannot contain an unsafe char [ ${a} ].`,e.line,n+r.index,this,r.raw)}}))}};var f={};Object.defineProperty(f,"__esModule",{value:!0}),f.default={id:"attr-value-double-quotes",description:"Attribute values must be in double quotes.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let i=0,s=a.length;i<s;i++)r=a[i],(""!==r.value&&'"'!==r.quote||""===r.value&&"'"===r.quote)&&t.error(`The value of attribute [ ${r.name} ] must be in double quotes.`,e.line,n+r.index,this,r.raw)}))}};var p={};Object.defineProperty(p,"__esModule",{value:!0}),p.default={id:"attr-value-not-empty",description:"All attributes must have values.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let i=0,s=a.length;i<s;i++)r=a[i],""===r.quote&&""===r.value&&t.warn(`The attribute [ ${r.name} ] must have a value.`,e.line,n+r.index,this,r.raw)}))}};var h={};Object.defineProperty(h,"__esModule",{value:!0}),h.default={id:"attr-value-single-quotes",description:"Attribute values must be in single quotes.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let i=0,s=a.length;i<s;i++)r=a[i],(""!==r.value&&"'"!==r.quote||""===r.value&&'"'===r.quote)&&t.error(`The value of attribute [ ${r.name} ] must be in single quotes.`,e.line,n+r.index,this,r.raw)}))}};var m={};Object.defineProperty(m,"__esModule",{value:!0}),m.default={id:"attr-whitespace",description:"All attributes should be separated by only one space and not have leading/trailing whitespace.",init(e,t,a){const r=Array.isArray(a)?a:[];e.addListener("tagstart",(e=>{const a=e.attrs;let n;const i=e.col+e.tagName.length+1;a.forEach((a=>{n=a;const s=a.name;-1===r.indexOf(s)&&(a.value.trim()!==a.value&&t.error(`The attributes of [ ${s} ] must not have leading or trailing whitespace.`,e.line,i+n.index,this,n.raw),a.value.replace(/ +(?= )/g,"")!==a.value&&t.error(`The attributes of [ ${s} ] must be separated by only one space.`,e.line,i+n.index,this,n.raw))}))}))}};var b={};Object.defineProperty(b,"__esModule",{value:!0}),b.default={id:"doctype-first",description:"Doctype must be declared first.",init(e,t){const a=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,this,r.raw),e.removeListener("all",a))};e.addListener("all",a)}};var v={};Object.defineProperty(v,"__esModule",{value:!0}),v.default={id:"doctype-html5",description:'Invalid doctype. Use: "<!DOCTYPE html>"',init(e,t){const a=e=>{!1===e.long&&"doctype html"!==e.content.toLowerCase()&&t.warn('Invalid doctype. Use: "<!DOCTYPE html>"',e.line,e.col,this,e.raw)},r=()=>{e.removeListener("comment",a),e.removeListener("tagstart",r)};e.addListener("all",a),e.addListener("tagstart",r)}};var y={};Object.defineProperty(y,"__esModule",{value:!0}),y.default={id:"head-script-disabled",description:"The <script> tag cannot be used in a <head> tag.",init(e,t){const a=/^(text\/javascript|application\/javascript)$/i;let r=!1;const n=n=>{const i=e.getMapAttrs(n.attrs).type,s=n.tagName.toLowerCase();"head"===s&&(r=!0),!0!==r||"script"!==s||i&&!0!==a.test(i)||t.warn("The <script> tag cannot be used in a <head> tag.",n.line,n.col,this,n.raw)},i=t=>{"head"===t.tagName.toLowerCase()&&(e.removeListener("tagstart",n),e.removeListener("tagend",i))};e.addListener("tagstart",n),e.addListener("tagend",i)}};var w={};Object.defineProperty(w,"__esModule",{value:!0}),w.default={id:"href-abs-or-rel",description:"An href attribute must be either absolute or relative.",init(e,t,a){const r="abs"===a?"absolute":"relative";e.addListener("tagstart",(e=>{const a=e.attrs;let n;const i=e.col+e.tagName.length+1;for(let s=0,l=a.length;s<l;s++)if(n=a[s],"href"===n.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,i+n.index,this,n.raw);break}}))}};var x={};Object.defineProperty(x,"__esModule",{value:!0});x.default={id:"html-lang-require",description:"The lang attribute of an <html> element must be present and should be valid.",init(e,t){e.addListener("tagstart",(a=>{const r=a.tagName.toLowerCase(),n=e.getMapAttrs(a.attrs),i=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 n?n.lang?s.test(n.lang)||t.warn("The lang attribute value of <html> element must be a valid BCP47.",a.line,i,this,a.raw):t.warn("The lang attribute of <html> element must have a value.",a.line,i,this,a.raw):t.warn("An lang attribute must be present on <html> elements.",a.line,i,this,a.raw))}))}};var O={};Object.defineProperty(O,"__esModule",{value:!0}),O.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(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r,n;const i=e.col+e.tagName.length+1;for(let s=0,l=a.length;s<l;s++)r=a[s],n=r.name,/^(id|class)$/i.test(n)&&/(^|[-_])ad([-_]|$)/i.test(r.value)&&t.warn(`The value of attribute ${n} cannot use the ad keyword.`,e.line,i+r.index,this,r.raw)}))}};var L={};Object.defineProperty(L,"__esModule",{value:!0}),L.default={id:"id-class-value",description:"The id and class attribute values must meet the specified rules.",init(e,t,a){let r;if(r="string"==typeof a?{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."}}[a]:a,"object"==typeof r&&r.regId){let a=r.regId;const n=r.message;a instanceof RegExp||(a=new RegExp(a)),e.addListener("tagstart",(e=>{const r=e.attrs;let i;const s=e.col+e.tagName.length+1;for(let l=0,o=r.length;l<o;l++)if(i=r[l],"id"===i.name.toLowerCase()&&!1===a.test(i.value)&&t.warn(n,e.line,s+i.index,this,i.raw),"class"===i.name.toLowerCase()){const r=i.value.split(/\s+/g);let l;for(let o=0,d=r.length;o<d;o++)l=r[o],l&&!1===a.test(l)&&t.warn(n,e.line,s+i.index,this,l)}}))}}};var j={};Object.defineProperty(j,"__esModule",{value:!0}),j.default={id:"id-unique",description:"The value of id attributes must be unique.",init(e,t){const a={};e.addListener("tagstart",(e=>{const r=e.attrs;let n,i;const s=e.col+e.tagName.length+1;for(let l=0,o=r.length;l<o;l++)if(n=r[l],"id"===n.name.toLowerCase()){i=n.value,i&&(void 0===a[i]?a[i]=1:a[i]++,a[i]>1&&t.error(`The id value [ ${i} ] must be unique.`,e.line,s+n.index,this,n.raw));break}}))}};var _={};Object.defineProperty(_,"__esModule",{value:!0}),_.default={id:"inline-script-disabled",description:"Inline script cannot be used.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;let i;const 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;for(let l=0,o=a.length;l<o;l++)r=a[l],i=r.name.toLowerCase(),!0===s.test(i)?t.warn(`Inline script [ ${r.raw} ] cannot be used.`,e.line,n+r.index,this,r.raw):"src"!==i&&"href"!==i||/^\s*javascript:/i.test(r.value)&&t.warn(`Inline script [ ${r.raw} ] cannot be used.`,e.line,n+r.index,this,r.raw)}))}};var P={};Object.defineProperty(P,"__esModule",{value:!0}),P.default={id:"inline-style-disabled",description:"Inline style cannot be used.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let i=0,s=a.length;i<s;i++)r=a[i],"style"===r.name.toLowerCase()&&t.warn(`Inline style [ ${r.raw} ] cannot be used.`,e.line,n+r.index,this,r.raw)}))}};var T={};Object.defineProperty(T,"__esModule",{value:!0}),T.default={id:"input-requires-label",description:"All [ input ] tags must have a corresponding [ label ] tag. ",init(e,t){const a=[],r=[];e.addListener("tagstart",(t=>{const n=t.tagName.toLowerCase(),i=e.getMapAttrs(t.attrs),s=t.col+n.length+1;"input"===n&&"hidden"!==i.type&&r.push({event:t,col:s,id:i.id}),"label"===n&&"for"in i&&""!==i.for&&a.push({event:t,col:s,forValue:i.for})})),e.addListener("end",(()=>{r.forEach((e=>{(function(e){let t=!1;return a.forEach((a=>{e.id&&e.id===a.forValue&&(t=!0)})),t})(e)||t.warn("No matching [ label ] tag found.",e.event.line,e.col,this,e.event.raw)}))}))}};var $={};Object.defineProperty($,"__esModule",{value:!0}),$.default={id:"script-disabled",description:"The <script> tag cannot be used.",init(e,t){e.addListener("tagstart",(e=>{"script"===e.tagName.toLowerCase()&&t.error("The <script> tag cannot be used.",e.line,e.col,this,e.raw)}))}};var A={};Object.defineProperty(A,"__esModule",{value:!0}),A.default={id:"space-tab-mixed-disabled",description:"Do not mix tabs and spaces for indentation.",init(e,t,a){let r="nomix",n=null;if("string"==typeof a){const e=/^([a-z]+)(\d+)?/.exec(a);e&&(r=e[1],n=e[2]&&parseInt(e[2],10))}e.addListener("text",(a=>{const i=a.raw,s=/(^|\r?\n)([ \t]+)/g;let l;for(;l=s.exec(i);){const i=e.fixPos(a,l.index+l[1].length);if(1!==i.col)continue;const s=l[2];"space"===r?n?!1!==/^ +$/.test(s)&&s.length%n==0||t.warn(`Please use space for indentation and keep ${n} length.`,i.line,1,this,a.raw):!1===/^ +$/.test(s)&&t.warn("Please use space for indentation.",i.line,1,this,a.raw):"tab"===r&&!1===/^\t+$/.test(s)?t.warn("Please use tab for indentation.",i.line,1,this,a.raw):!0===/ +\t|\t+ /.test(s)&&t.warn("Do not mix tabs and spaces for indentation.",i.line,1,this,a.raw)}}))}};var k={};Object.defineProperty(k,"__esModule",{value:!0}),k.default={id:"spec-char-escape",description:"Special characters must be escaped.",init(e,t){e.addListener("text",(a=>{const r=a.raw,n=/([<>])|( \& )/g;let i;for(;i=n.exec(r);){const r=e.fixPos(a,i.index);t.error(`Special characters must be escaped : [ ${i[0]} ].`,r.line,r.col,this,a.raw)}}))}};var M={};Object.defineProperty(M,"__esModule",{value:!0}),M.default={id:"src-not-empty",description:"The src attribute of an img(script,link) must have a value.",init(e,t){e.addListener("tagstart",(e=>{const a=e.tagName,r=e.attrs;let n;const i=e.col+a.length+1;for(let s=0,l=r.length;s<l;s++)n=r[s],(!0===/^(img|script|embed|bgsound|iframe)$/.test(a)&&"src"===n.name||"link"===a&&"href"===n.name||"object"===a&&"data"===n.name)&&""===n.value&&t.error(`The attribute [ ${n.name} ] of the tag [ ${a} ] must have a value.`,e.line,i+n.index,this,n.raw)}))}};var N={};Object.defineProperty(N,"__esModule",{value:!0}),N.default={id:"style-disabled",description:"<style> tags cannot be used.",init(e,t){e.addListener("tagstart",(e=>{"style"===e.tagName.toLowerCase()&&t.warn("The <style> tag cannot be used.",e.line,e.col,this,e.raw)}))}};var C={};Object.defineProperty(C,"__esModule",{value:!0}),C.default={id:"tag-pair",description:"Tag must be paired.",init(e,t){const 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",(e=>{const t=e.tagName.toLowerCase();void 0!==r[t]||e.close||a.push({tagName:t,line:e.line,raw:e.raw})})),e.addListener("tagend",(e=>{const r=e.tagName.toLowerCase();let n;for(n=a.length-1;n>=0&&a[n].tagName!==r;n--);if(n>=0){const r=[];for(let e=a.length-1;e>n;e--)r.push(`</${a[e].tagName}>`);if(r.length>0){const n=a[a.length-1];t.error(`Tag must be paired, missing: [ ${r.join("")} ], start tag match failed [ ${n.raw} ] on line ${n.line}.`,e.line,e.col,this,e.raw)}a.length=n}else t.error(`Tag must be paired, no start tag: [ ${e.raw} ]`,e.line,e.col,this,e.raw)})),e.addListener("end",(e=>{const r=[];for(let e=a.length-1;e>=0;e--)r.push(`</${a[e].tagName}>`);if(r.length>0){const n=a[a.length-1];t.error(`Tag must be paired, missing: [ ${r.join("")} ], open tag match failed [ ${n.raw} ] on line ${n.line}.`,e.line,e.col,this,"")}}))}};var q={};Object.defineProperty(q,"__esModule",{value:!0}),q.default={id:"tag-self-close",description:"Empty tags must be self closed.",init(e,t){const a=e.makeMap("area,base,basefont,bgsound,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(e=>{const r=e.tagName.toLowerCase();void 0!==a[r]&&(e.close||t.warn(`The empty tag : [ ${r} ] must be self closed.`,e.line,e.col,this,e.raw))}))}};var E={};Object.defineProperty(E,"__esModule",{value:!0}),E.default={id:"empty-tag-not-self-closed",description:"Empty tags must not use self closed syntax.",init(e,t){const a=e.makeMap("area,base,basefont,bgsound,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(e=>{const r=e.tagName.toLowerCase();void 0!==a[r]&&e.close&&t.error(`The empty tag : [ ${r} ] must not use self closed syntax.`,e.line,e.col,this,e.raw)}))}};var z={};Object.defineProperty(z,"__esModule",{value:!0}),z.default={id:"tagname-lowercase",description:"All html element names must be in lowercase.",init(e,t,a){const r=Array.isArray(a)?a:[];e.addListener("tagstart,tagend",(e=>{const a=e.tagName;-1===r.indexOf(a)&&a!==a.toLowerCase()&&t.error(`The html element name of [ ${a} ] must be in lowercase.`,e.line,e.col,this,e.raw)}))}};var R={};Object.defineProperty(R,"__esModule",{value:!0}),R.default={id:"tagname-specialchars",description:"All special characters must be escaped.",init(e,t){const a=/[^a-zA-Z0-9\-:_]/;e.addListener("tagstart,tagend",(e=>{const r=e.tagName;a.test(r)&&t.error(`The html element name of [ ${r} ] contains special character.`,e.line,e.col,this,e.raw)}))}};var D={};Object.defineProperty(D,"__esModule",{value:!0}),D.default={id:"title-require",description:"<title> must be present in <head> tag.",init(e,t){let a=!1,r=!1;const n=e=>{const t=e.tagName.toLowerCase();"head"===t?a=!0:"title"===t&&a&&(r=!0)},i=a=>{const s=a.tagName.toLowerCase();if(r&&"title"===s){const e=a.lastEvent;("text"!==e.type||"text"===e.type&&!0===/^\s*$/.test(e.raw))&&t.error("<title></title> must not be empty.",a.line,a.col,this,a.raw)}else"head"===s&&(!1===r&&t.error("<title> must be present in <head> tag.",a.line,a.col,this,a.raw),e.removeListener("tagstart",n),e.removeListener("tagend",i))};e.addListener("tagstart",n),e.addListener("tagend",i)}};var S={};Object.defineProperty(S,"__esModule",{value:!0});let U={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"]}};S.default={id:"tags-check",description:"Checks html tags.",init(e,t,a){U=Object.assign(Object.assign({},U),a),e.addListener("tagstart",(e=>{const a=e.attrs,r=e.col+e.tagName.length+1,n=e.tagName.toLowerCase();if(U[n]){const i=U[n];if(!0!==i.selfclosing||e.close?!1===i.selfclosing&&e.close&&t.warn(`The <${n}> tag must not be selfclosing.`,e.line,e.col,this,e.raw):t.warn(`The <${n}> tag must be selfclosing.`,e.line,e.col,this,e.raw),Array.isArray(i.attrsRequired)){i.attrsRequired.forEach((i=>{if(Array.isArray(i)){const s=i.map((e=>e)),l=s.shift(),o=s;a.some((e=>e.name===l))?a.forEach((a=>{a.name===l&&-1===o.indexOf(a.value)&&t.error(`The <${n}> tag must have attr '${l}' with one value of '${o.join("' or '")}'.`,e.line,r,this,e.raw)})):t.error(`The <${n}> tag must have attr '${l}'.`,e.line,r,this,e.raw)}else a.some((e=>-1!==i.split("|").indexOf(e.name)))||t.error(`The <${n}> tag must have attr '${i}'.`,e.line,r,this,e.raw)}))}if(Array.isArray(i.attrsOptional)){i.attrsOptional.forEach((i=>{if(Array.isArray(i)){const s=i.map((e=>e)),l=s.shift(),o=s;a.some((e=>e.name===l))&&a.forEach((a=>{a.name===l&&-1===o.indexOf(a.value)&&t.error(`The <${n}> tag must have optional attr '${l}' with one value of '${o.join("' or '")}'.`,e.line,r,this,e.raw)}))}}))}if(Array.isArray(i.redundantAttrs)){i.redundantAttrs.forEach((i=>{a.some((e=>e.name===i))&&t.error(`The attr '${i}' is redundant for <${n}> and should be omitted.`,e.line,r,this,e.raw)}))}}}))}};var H={};Object.defineProperty(H,"__esModule",{value:!0}),H.default={id:"attr-no-unnecessary-whitespace",description:"No spaces between attribute names and values.",init(e,t,a){const r=Array.isArray(a)?a:[];e.addListener("tagstart",(e=>{const a=e.attrs,n=e.col+e.tagName.length+1;for(let i=0;i<a.length;i++)if(-1===r.indexOf(a[i].name)){const r=/(\s*)=(\s*)/.exec(a[i].raw.trim());!r||0===r[1].length&&0===r[2].length||t.error(`The attribute '${a[i].name}' must not have spaces between the name and value.`,e.line,n+a[i].index,this,a[i].raw)}}))}};var I={};var Z=t(Object.freeze({__proto__:null,htmlElementAttributes:{"*":["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","popover","slot","spellcheck","style","tabindex","title","translate"],a:["charset","coords","download","href","hreflang","name","ping","referrerpolicy","rel","rev","shape","target","type"],applet:["align","alt","archive","code","codebase","height","hspace","name","object","vspace","width"],area:["alt","coords","download","href","hreflang","nohref","ping","referrerpolicy","rel","shape","target","type"],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],base:["href","target"],basefont:["color","face","size"],blockquote:["cite"],body:["alink","background","bgcolor","link","text","vlink"],br:["clear"],button:["disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","name","popovertarget","popovertargetaction","type","value"],canvas:["height","width"],caption:["align"],col:["align","char","charoff","span","valign","width"],colgroup:["align","char","charoff","span","valign","width"],data:["value"],del:["cite","datetime"],details:["open"],dialog:["open"],dir:["compact"],div:["align"],dl:["compact"],embed:["height","src","type","width"],fieldset:["disabled","form","name"],font:["color","face","size"],form:["accept","accept-charset","action","autocomplete","enctype","method","name","novalidate","target"],frame:["frameborder","longdesc","marginheight","marginwidth","name","noresize","scrolling","src"],frameset:["cols","rows"],h1:["align"],h2:["align"],h3:["align"],h4:["align"],h5:["align"],h6:["align"],head:["profile"],hr:["align","noshade","size","width"],html:["manifest","version"],iframe:["align","allow","allowfullscreen","allowpaymentrequest","allowusermedia","frameborder","height","loading","longdesc","marginheight","marginwidth","name","referrerpolicy","sandbox","scrolling","src","srcdoc","width"],img:["align","alt","border","crossorigin","decoding","fetchpriority","height","hspace","ismap","loading","longdesc","name","referrerpolicy","sizes","src","srcset","usemap","vspace","width"],input:["accept","align","alt","autocomplete","checked","dirname","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","ismap","list","max","maxlength","min","minlength","multiple","name","pattern","placeholder","popovertarget","popovertargetaction","readonly","required","size","src","step","type","usemap","value","width"],ins:["cite","datetime"],isindex:["prompt"],label:["for","form"],legend:["align"],li:["type","value"],link:["as","blocking","charset","color","crossorigin","disabled","fetchpriority","href","hreflang","imagesizes","imagesrcset","integrity","media","referrerpolicy","rel","rev","sizes","target","type"],map:["name"],menu:["compact"],meta:["charset","content","http-equiv","media","name","scheme"],meter:["high","low","max","min","optimum","value"],object:["align","archive","border","classid","codebase","codetype","data","declare","form","height","hspace","name","standby","type","typemustmatch","usemap","vspace","width"],ol:["compact","reversed","start","type"],optgroup:["disabled","label"],option:["disabled","label","selected","value"],output:["for","form","name"],p:["align"],param:["name","type","value","valuetype"],pre:["width"],progress:["max","value"],q:["cite"],script:["async","blocking","charset","crossorigin","defer","fetchpriority","integrity","language","nomodule","referrerpolicy","src","type"],select:["autocomplete","disabled","form","multiple","name","required","size"],slot:["name"],source:["height","media","sizes","src","srcset","type","width"],style:["blocking","media","type"],table:["align","bgcolor","border","cellpadding","cellspacing","frame","rules","summary","width"],tbody:["align","char","charoff","valign"],td:["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"],textarea:["autocomplete","cols","dirname","disabled","form","maxlength","minlength","name","placeholder","readonly","required","rows","wrap"],tfoot:["align","char","charoff","valign"],th:["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"],thead:["align","char","charoff","valign"],time:["datetime"],tr:["align","bgcolor","char","charoff","valign"],track:["default","kind","label","src","srclang"],ul:["compact","type"],video:["autoplay","controls","crossorigin","height","loop","muted","playsinline","poster","preload","src","width"]}}));Object.defineProperty(I,"__esModule",{value:!0});const F=Z;I.default={id:"attr-invalid",description:"Attributes must be valid for the given HTML tags.",init(e,t){const a=F.htmlElementAttributes["*"]||[];e.addListener("tagstart",(e=>{const r=e.tagName.toLowerCase(),n=e.attrs,i=F.htmlElementAttributes[r]||[],s=[...a,...i];for(const a of n)s.includes(a.name)||t.error(`The attribute [ ${a.name} ] is not valid for the tag [ ${r} ].`,e.line,e.col+e.tagName.length+1+a.index,this,a.raw)}))}};var V={};Object.defineProperty(V,"__esModule",{value:!0});const B=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"];return V.default={id:"invalid-tag",description:"All tags must be valid HTML tags.",init(e,t){const a=[];e.addListener("tagstart",(e=>{const r=e.tagName;B.includes(r)?a.push(r):t.error(`The tag [ ${r} ] is not a valid HTML tag.`,e.line,e.col,this,e.raw)})),e.addListener("tagend",(e=>{const r=e.tagName;if(B.includes(r)){const e=a.lastIndexOf(r);-1!==e&&a.splice(e,1)}else t.error(`The closing tag [ ${r} ] is not a valid HTML tag.`,e.line,e.col,this,e.raw)})),e.addListener("end",(()=>{a.forEach((e=>{t.error(`The tag [ ${e} ] was opened but never closed.`,0,0,this,"")}))}))}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.invalidTag=e.attrInvalid=e.attrNoUnnecessaryWhitespace=e.tagsCheck=e.titleRequire=e.tagnameSpecialChars=e.tagnameLowercase=e.emptyTagNotSelfClosed=e.tagSelfClose=e.tagPair=e.styleDisabled=e.srcNotEmpty=e.specCharEscape=e.spaceTabMixedDisabled=e.scriptDisabled=e.inputRequiresLabel=e.inlineStyleDisabled=e.inlineScriptDisabled=e.idUnique=e.idClassValue=e.idClsasAdDisabled=e.htmlLangRequire=e.hrefAbsOrRel=e.headScriptDisabled=e.doctypeHTML5=e.doctypeFirst=e.attrWhitespace=e.attrValueSingleQuotes=e.attrValueNotEmpty=e.attrValueDoubleQuotes=e.attrUnsafeChars=e.attrNoDuplication=e.attrSort=e.attrLowercase=e.altRequire=void 0;var t=s;Object.defineProperty(e,"altRequire",{enumerable:!0,get:function(){return t.default}});var a=l;Object.defineProperty(e,"attrLowercase",{enumerable:!0,get:function(){return a.default}});var r=c;Object.defineProperty(e,"attrSort",{enumerable:!0,get:function(){return r.default}});var n=u;Object.defineProperty(e,"attrNoDuplication",{enumerable:!0,get:function(){return n.default}});var i=g;Object.defineProperty(e,"attrUnsafeChars",{enumerable:!0,get:function(){return i.default}});var o=f;Object.defineProperty(e,"attrValueDoubleQuotes",{enumerable:!0,get:function(){return o.default}});var d=p;Object.defineProperty(e,"attrValueNotEmpty",{enumerable:!0,get:function(){return d.default}});var U=h;Object.defineProperty(e,"attrValueSingleQuotes",{enumerable:!0,get:function(){return U.default}});var Z=m;Object.defineProperty(e,"attrWhitespace",{enumerable:!0,get:function(){return Z.default}});var F=b;Object.defineProperty(e,"doctypeFirst",{enumerable:!0,get:function(){return F.default}});var B=v;Object.defineProperty(e,"doctypeHTML5",{enumerable:!0,get:function(){return B.default}});var Y=y;Object.defineProperty(e,"headScriptDisabled",{enumerable:!0,get:function(){return Y.default}});var W=w;Object.defineProperty(e,"hrefAbsOrRel",{enumerable:!0,get:function(){return W.default}});var J=x;Object.defineProperty(e,"htmlLangRequire",{enumerable:!0,get:function(){return J.default}});var Q=O;Object.defineProperty(e,"idClsasAdDisabled",{enumerable:!0,get:function(){return Q.default}});var X=L;Object.defineProperty(e,"idClassValue",{enumerable:!0,get:function(){return X.default}});var G=j;Object.defineProperty(e,"idUnique",{enumerable:!0,get:function(){return G.default}});var K=_;Object.defineProperty(e,"inlineScriptDisabled",{enumerable:!0,get:function(){return K.default}});var ee=P;Object.defineProperty(e,"inlineStyleDisabled",{enumerable:!0,get:function(){return ee.default}});var te=T;Object.defineProperty(e,"inputRequiresLabel",{enumerable:!0,get:function(){return te.default}});var ae=$;Object.defineProperty(e,"scriptDisabled",{enumerable:!0,get:function(){return ae.default}});var re=A;Object.defineProperty(e,"spaceTabMixedDisabled",{enumerable:!0,get:function(){return re.default}});var ne=k;Object.defineProperty(e,"specCharEscape",{enumerable:!0,get:function(){return ne.default}});var ie=M;Object.defineProperty(e,"srcNotEmpty",{enumerable:!0,get:function(){return ie.default}});var se=N;Object.defineProperty(e,"styleDisabled",{enumerable:!0,get:function(){return se.default}});var le=C;Object.defineProperty(e,"tagPair",{enumerable:!0,get:function(){return le.default}});var oe=q;Object.defineProperty(e,"tagSelfClose",{enumerable:!0,get:function(){return oe.default}});var de=E;Object.defineProperty(e,"emptyTagNotSelfClosed",{enumerable:!0,get:function(){return de.default}});var ce=z;Object.defineProperty(e,"tagnameLowercase",{enumerable:!0,get:function(){return ce.default}});var ue=R;Object.defineProperty(e,"tagnameSpecialChars",{enumerable:!0,get:function(){return ue.default}});var ge=D;Object.defineProperty(e,"titleRequire",{enumerable:!0,get:function(){return ge.default}});var fe=S;Object.defineProperty(e,"tagsCheck",{enumerable:!0,get:function(){return fe.default}});var pe=H;Object.defineProperty(e,"attrNoUnnecessaryWhitespace",{enumerable:!0,get:function(){return pe.default}});var he=I;Object.defineProperty(e,"attrInvalid",{enumerable:!0,get:function(){return he.default}});var me=V;Object.defineProperty(e,"invalidTag",{enumerable:!0,get:function(){return me.default}})}(i),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLParser=e.Reporter=e.HTMLRules=e.HTMLHint=void 0;const t=r;e.HTMLParser=t.default;const a=n;e.Reporter=a.default;const s=i;e.HTMLRules=s;function l(e,t){return new Array(e+1).join(t||" ")}e.HTMLHint=new class{constructor(){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}}addRule(e){this.rules[e.id]=e}verify(e,r=this.defaultRuleset){0===Object.keys(r).length&&(r=this.defaultRuleset),e=e.replace(/^\s*<!--\s*htmlhint\s+([^\r\n]+?)\s*-->/i,((e,t)=>(t.replace(/(?:^|,)\s*([^:,]+)\s*(?:\:\s*([^,\s]+))?/g,((e,t,a)=>(r[t]=!(void 0!==a&&a.length>0)||JSON.parse(a),""))),"")));const n=new t.default,i=new a.default(e,r),s=this.rules;let l;for(const e in r)l=s[e],void 0!==l&&!1!==r[e]&&l.init(n,i,r[e]);return n.parse(e),i.messages}format(e,t={}){const a=[],r={white:"",grey:"",red:"",reset:""};t.colors&&(r.white="",r.grey="",r.red="",r.reset="");const n=t.indent||0;return e.forEach((e=>{let t=e.evidence;const i=e.line,s=e.col,o=t.length;let d=s>41?s-40:1,c=t.length>s+60?s+60:o;s<41&&(c+=40-s+1),t=t.replace(/\t/g," ").substring(d-1,c),d>1&&(t=`...${t}`,d-=3),c<o&&(t+="..."),a.push(`${r.white+l(n)}L${i} |${r.grey}${t}${r.reset}`);let u=s-d;const g=t.substring(0,u).match(/[^\u0000-\u00ff]/g);null!==g&&(u+=g.length),a.push(`${r.white+l(n)+l(String(i).length+3+u)}^ ${r.red}${e.message} (${e.rule.id})${r.reset}`)})),a}},Object.keys(s).forEach((t=>{e.HTMLHint.addRule(s[t])}))}(a),e(a)}));
{
"name": "htmlhint-invalid-attribute-rule",
"version": "0.0.3",
"version": "0.0.4",
"description": "Add invalid attribute rule to htmlhint",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc