diff --git a/dist/htmlhint.js b/dist/htmlhint.js
index 327919bdf..c0e4738a9 100644
--- a/dist/htmlhint.js
+++ b/dist/htmlhint.js
@@ -80,29 +80,29 @@
a.d(n, 'attrLowercase', function() {
return o;
}),
- a.d(n, 'attrNoDuplication', function() {
+ a.d(n, 'attrSortedn', function() {
return l;
}),
- a.d(n, 'attrUnsafeChars', function() {
+ a.d(n, 'attrNoDuplication', function() {
return u;
}),
- a.d(n, 'attrValueDoubleQuotes', function() {
+ a.d(n, 'attrUnsafeChars', function() {
return c;
}),
- a.d(n, 'attrValueNotEmpty', function() {
+ a.d(n, 'attrValueDoubleQuotes', function() {
return d;
}),
- a.d(n, 'attrWhitespace', function() {
+ a.d(n, 'attrValueNotEmpty', function() {
return f;
}),
a.d(n, 'csslint', function() {
return g;
}),
a.d(n, 'doctypeFirst', function() {
- return p;
+ return m;
}),
a.d(n, 'doctypeHTML5', function() {
- return m;
+ return p;
}),
a.d(n, 'headScriptDisabled', function() {
return v;
@@ -135,13 +135,13 @@
return j;
}),
a.d(n, 'specCharEscape', function() {
- return A;
+ return S;
}),
a.d(n, 'srcNotEmpty', function() {
return q;
}),
a.d(n, 'styleDisabled', function() {
- return S;
+ return A;
}),
a.d(n, 'tagPair', function() {
return M;
@@ -150,10 +150,10 @@
return E;
}),
a.d(n, 'tagnameLowercase', function() {
- return _;
+ return I;
}),
a.d(n, 'titleRequire', function() {
- return D;
+ return O;
});
var r = class {
constructor() {
@@ -182,12 +182,12 @@
f = /\s*([^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+)(?:\s*=\s*(?:(")([^"]*)"|(')([^']*)'|([^\s"'>]*)))?/g,
h = /\r?\n/g,
g = 0,
- p = 0,
m = 0,
+ p = 0,
v = 1,
b = u._arrBlocks;
function w(e, t, a, n) {
- var r = a - m + 1;
+ var r = a - p + 1;
for (
void 0 === n && (n = {}),
n.raw = t,
@@ -199,7 +199,7 @@
h.exec(t);
)
- v++, (m = a + h.lastIndex);
+ v++, (p = a + h.lastIndex);
}
for (u.fire('start', { pos: 0, line: 1, col: 1 }); (t = d.exec(e)); )
if (
@@ -209,7 +209,7 @@
!(n = t[1]) ||
(i &&
n === i &&
- (w('cdata', (l = o.join('')), p, { tagName: i, attrs: s }),
+ (w('cdata', (l = o.join('')), m, { tagName: i, attrs: s }),
(i = null),
(s = null),
(o = null)),
@@ -237,7 +237,7 @@
attrs: r,
close: t[6]
}),
- c[n] && ((i = n), (s = r.concat()), (o = []), (p = g)))
+ c[n] && ((i = n), (s = r.concat()), (o = []), (m = g)))
: w('text', t[0], a);
} else
(t[2] || t[3]) &&
@@ -247,7 +247,7 @@
});
else w('tagend', t[0], a, { tagName: n });
e.length > g && w('text', (l = e.substring(g, e.length)), g),
- u.fire('end', { pos: g, line: v, col: e.length - m + 1 });
+ u.fire('end', { pos: g, line: v, col: e.length - p + 1 });
}
addListener(e, t) {
for (
@@ -394,6 +394,58 @@
}
},
l = {
+ id: 'attr-sorted',
+ description: 'Attribute tags must be in proper order.',
+ init: function(e, t) {
+ for (
+ var a = this,
+ n = {},
+ r = [
+ 'class',
+ 'id',
+ 'name',
+ 'src',
+ 'for',
+ 'type',
+ 'href',
+ 'value',
+ 'title',
+ 'alt',
+ 'role'
+ ],
+ i = 0;
+ i < r.length;
+ i++
+ )
+ n[r[i]] = i;
+ e.addListener('tagstart', function(e) {
+ for (var r = e.attrs, i = [], s = 0; s < r.length; s++)
+ i.push(r[s].name);
+ var o = JSON.stringify(i);
+ i.sort(function(e, t) {
+ return null == n[e] && null == n[t]
+ ? 0
+ : null == n[e]
+ ? 1
+ : null == n[t]
+ ? -1
+ : n[e] - n[t] || e.localeCompare(t);
+ }),
+ o !== JSON.stringify(i) &&
+ t.error(
+ 'Inaccurate order ' +
+ o +
+ ' should be in hierarchy ' +
+ JSON.stringify(i) +
+ ' ',
+ e.line,
+ e.col,
+ a
+ );
+ });
+ }
+ },
+ u = {
id: 'attr-no-duplication',
description: 'Elements cannot have duplicate attributes.',
init: function(e, t) {
@@ -422,7 +474,7 @@
});
}
},
- u = {
+ c = {
id: 'attr-unsafe-chars',
description: 'Attribute values cannot contain unsafe chars.',
init: function(e, t) {
@@ -458,7 +510,7 @@
});
}
},
- c = {
+ d = {
id: 'attr-value-double-quotes',
description: 'Attribute values must be in double quotes.',
init: function(e, t) {
@@ -487,7 +539,7 @@
});
}
},
- d = {
+ f = {
id: 'attr-value-not-empty',
description: 'All attributes must have values.',
init: function(e, t) {
@@ -514,48 +566,6 @@
});
}
},
- f = {
- id: 'attr-whitespace',
- description:
- 'All attributes should be separated by only one space and not have leading/trailing whitespace.',
- init: function(e, t, a) {
- var n = this,
- r = Array.isArray(a) ? a : [];
- e.addListener('tagstart', function(e) {
- var a,
- i = e.attrs,
- s = e.col + e.tagName.length + 1;
- i.forEach(function(i) {
- a = i;
- var o = i.name;
- -1 === r.indexOf(o) &&
- (console.log('Here'),
- i.value.trim(i.value) !== i.value &&
- (console.log('Here3'),
- t.error(
- 'The attributes of [ ' +
- o +
- ' ] must not have trailing whitespace.',
- e.line,
- s + a.index,
- n,
- a.raw
- )),
- i.value.replace(/ +(?= )/g, '') !== i.value &&
- (console.log('Here2'),
- t.error(
- 'The attributes of [ ' +
- o +
- ' ] must be separated by only one space.',
- e.line,
- s + a.index,
- n,
- a.raw
- )));
- });
- });
- }
- },
h = a(0),
g = {
id: 'csslint',
@@ -585,7 +595,7 @@
});
}
},
- p = {
+ m = {
id: 'doctype-first',
description: 'Doctype must be declared first.',
init: function(e, t) {
@@ -607,7 +617,7 @@
e.addListener('all', n);
}
},
- m = {
+ p = {
id: 'doctype-html5',
description: 'Invalid doctype. Use: ""',
init: function(e, t) {
@@ -1000,7 +1010,7 @@
});
}
},
- A = {
+ S = {
id: 'spec-char-escape',
description: 'Special characters must be escaped.',
init: function(e, t) {
@@ -1056,7 +1066,7 @@
});
}
},
- S = {
+ A = {
id: 'style-disabled',
description: '