html-validate 8.11.0 → 8.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/core.js +116 -12
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/tsdoc-metadata.json +1 -1
- package/dist/es/core.js +116 -12
- package/dist/es/core.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +9 -14
package/dist/cjs/core.js
CHANGED
|
@@ -1963,6 +1963,55 @@ function factory$1(name, context) {
|
|
|
1963
1963
|
}
|
|
1964
1964
|
}
|
|
1965
1965
|
|
|
1966
|
+
const escapedCodepoints = ["9", "a", "d"];
|
|
1967
|
+
function* splitSelectorElements(selector) {
|
|
1968
|
+
let begin = 0;
|
|
1969
|
+
let end = 0;
|
|
1970
|
+
function initialState(ch, p) {
|
|
1971
|
+
if (ch === "\\") {
|
|
1972
|
+
return 1 /* ESCAPED */;
|
|
1973
|
+
}
|
|
1974
|
+
if (ch === " ") {
|
|
1975
|
+
end = p;
|
|
1976
|
+
return 2 /* WHITESPACE */;
|
|
1977
|
+
}
|
|
1978
|
+
return 0 /* INITIAL */;
|
|
1979
|
+
}
|
|
1980
|
+
function escapedState(ch) {
|
|
1981
|
+
if (escapedCodepoints.includes(ch)) {
|
|
1982
|
+
return 1 /* ESCAPED */;
|
|
1983
|
+
}
|
|
1984
|
+
return 0 /* INITIAL */;
|
|
1985
|
+
}
|
|
1986
|
+
function* whitespaceState(ch, p) {
|
|
1987
|
+
if (ch === " ") {
|
|
1988
|
+
return 2 /* WHITESPACE */;
|
|
1989
|
+
}
|
|
1990
|
+
yield selector.slice(begin, end);
|
|
1991
|
+
begin = p;
|
|
1992
|
+
end = p;
|
|
1993
|
+
return 0 /* INITIAL */;
|
|
1994
|
+
}
|
|
1995
|
+
let state = 0 /* INITIAL */;
|
|
1996
|
+
for (let p = 0; p < selector.length; p++) {
|
|
1997
|
+
const ch = selector[p];
|
|
1998
|
+
switch (state) {
|
|
1999
|
+
case 0 /* INITIAL */:
|
|
2000
|
+
state = initialState(ch, p);
|
|
2001
|
+
break;
|
|
2002
|
+
case 1 /* ESCAPED */:
|
|
2003
|
+
state = escapedState(ch);
|
|
2004
|
+
break;
|
|
2005
|
+
case 2 /* WHITESPACE */:
|
|
2006
|
+
state = yield* whitespaceState(ch, p);
|
|
2007
|
+
break;
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
if (begin !== selector.length) {
|
|
2011
|
+
yield selector.slice(begin);
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
|
|
1966
2015
|
function stripslashes(value) {
|
|
1967
2016
|
return value.replace(/\\(.)/g, "$1");
|
|
1968
2017
|
}
|
|
@@ -2162,13 +2211,8 @@ class Selector {
|
|
|
2162
2211
|
}
|
|
2163
2212
|
static parse(selector) {
|
|
2164
2213
|
selector = selector.replace(/([+~>]) /g, "$1");
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
return Array.from(selector.matchAll(delimiter), (match) => {
|
|
2168
|
-
const end = match.index + 1;
|
|
2169
|
-
const part = unescapeCodepoint(selector.slice(begin, end));
|
|
2170
|
-
begin = end + 1;
|
|
2171
|
-
return new Pattern(part);
|
|
2214
|
+
return Array.from(splitSelectorElements(selector), (element) => {
|
|
2215
|
+
return new Pattern(unescapeCodepoint(element));
|
|
2172
2216
|
});
|
|
2173
2217
|
}
|
|
2174
2218
|
static findCandidates(root, pattern) {
|
|
@@ -6233,7 +6277,7 @@ const defaults$h = {
|
|
|
6233
6277
|
minInitialRank: "h1",
|
|
6234
6278
|
sectioningRoots: ["dialog", '[role="dialog"]', '[role="alertdialog"]']
|
|
6235
6279
|
};
|
|
6236
|
-
function isRelevant$
|
|
6280
|
+
function isRelevant$6(event) {
|
|
6237
6281
|
const node = event.target;
|
|
6238
6282
|
return Boolean(node.meta && node.meta.heading);
|
|
6239
6283
|
}
|
|
@@ -6300,7 +6344,7 @@ class HeadingLevel extends Rule {
|
|
|
6300
6344
|
};
|
|
6301
6345
|
}
|
|
6302
6346
|
setup() {
|
|
6303
|
-
this.on("tag:start", isRelevant$
|
|
6347
|
+
this.on("tag:start", isRelevant$6, (event) => {
|
|
6304
6348
|
this.onTagStart(event);
|
|
6305
6349
|
});
|
|
6306
6350
|
this.on("tag:ready", (event) => {
|
|
@@ -6940,7 +6984,7 @@ class MapDupName extends Rule {
|
|
|
6940
6984
|
}
|
|
6941
6985
|
}
|
|
6942
6986
|
|
|
6943
|
-
function isRelevant$
|
|
6987
|
+
function isRelevant$5(event) {
|
|
6944
6988
|
return event.target.is("map");
|
|
6945
6989
|
}
|
|
6946
6990
|
function hasStaticValue(attr) {
|
|
@@ -6954,7 +6998,7 @@ class MapIdName extends Rule {
|
|
|
6954
6998
|
};
|
|
6955
6999
|
}
|
|
6956
7000
|
setup() {
|
|
6957
|
-
this.on("tag:ready", isRelevant$
|
|
7001
|
+
this.on("tag:ready", isRelevant$5, (event) => {
|
|
6958
7002
|
const { target } = event;
|
|
6959
7003
|
const id = target.getAttribute("id");
|
|
6960
7004
|
const name = target.getAttribute("name");
|
|
@@ -7029,6 +7073,62 @@ class MultipleLabeledControls extends Rule {
|
|
|
7029
7073
|
}
|
|
7030
7074
|
}
|
|
7031
7075
|
|
|
7076
|
+
const abstractRoles = [
|
|
7077
|
+
"command",
|
|
7078
|
+
"composite",
|
|
7079
|
+
"input",
|
|
7080
|
+
"landmark",
|
|
7081
|
+
"range",
|
|
7082
|
+
"roletype",
|
|
7083
|
+
"section",
|
|
7084
|
+
"sectionhead",
|
|
7085
|
+
"select",
|
|
7086
|
+
"structure",
|
|
7087
|
+
"widget",
|
|
7088
|
+
"window"
|
|
7089
|
+
];
|
|
7090
|
+
function isRelevant$4(event) {
|
|
7091
|
+
return event.key === "role";
|
|
7092
|
+
}
|
|
7093
|
+
class NoAbstractRole extends Rule {
|
|
7094
|
+
documentation(context) {
|
|
7095
|
+
return {
|
|
7096
|
+
description: [
|
|
7097
|
+
`Role \`"${context.role}"\` is abstract and must not be used.`,
|
|
7098
|
+
"",
|
|
7099
|
+
"WAI-ARIA defines a list of [abstract roles](https://www.w3.org/TR/wai-aria-1.2/#abstract_roles) which cannot be used by authors:",
|
|
7100
|
+
"",
|
|
7101
|
+
...abstractRoles.map((it) => `- \`"${it}"\``),
|
|
7102
|
+
"",
|
|
7103
|
+
`Use one of the defined subclass roles for \`"${context.role}"\` instead.`
|
|
7104
|
+
].join("\n"),
|
|
7105
|
+
url: "https://html-validate.org/rules/no-abstract-role.html"
|
|
7106
|
+
};
|
|
7107
|
+
}
|
|
7108
|
+
setup() {
|
|
7109
|
+
this.on("attr", isRelevant$4, (event) => {
|
|
7110
|
+
const roles = event.value;
|
|
7111
|
+
if (!roles || roles instanceof DynamicValue) {
|
|
7112
|
+
return;
|
|
7113
|
+
}
|
|
7114
|
+
const tokens = new DOMTokenList(roles, event.valueLocation);
|
|
7115
|
+
for (const { item: role, location } of tokens.iterator()) {
|
|
7116
|
+
if (!abstractRoles.includes(role)) {
|
|
7117
|
+
continue;
|
|
7118
|
+
}
|
|
7119
|
+
this.report({
|
|
7120
|
+
node: event.target,
|
|
7121
|
+
message: `Role "{{ role }}" is abstract and must not be used`,
|
|
7122
|
+
location,
|
|
7123
|
+
context: {
|
|
7124
|
+
role
|
|
7125
|
+
}
|
|
7126
|
+
});
|
|
7127
|
+
}
|
|
7128
|
+
});
|
|
7129
|
+
}
|
|
7130
|
+
}
|
|
7131
|
+
|
|
7032
7132
|
const defaults$e = {
|
|
7033
7133
|
include: null,
|
|
7034
7134
|
exclude: null
|
|
@@ -9438,6 +9538,7 @@ const bundledRules = {
|
|
|
9438
9538
|
"meta-refresh": MetaRefresh,
|
|
9439
9539
|
"missing-doctype": MissingDoctype,
|
|
9440
9540
|
"multiple-labeled-controls": MultipleLabeledControls,
|
|
9541
|
+
"no-abstract-role": NoAbstractRole,
|
|
9441
9542
|
"no-autoplay": NoAutoplay,
|
|
9442
9543
|
"no-conditional-comment": NoConditionalComment,
|
|
9443
9544
|
"no-deprecated-attr": NoDeprecatedAttr,
|
|
@@ -9491,6 +9592,7 @@ const config$4 = {
|
|
|
9491
9592
|
"hidden-focusable": "error",
|
|
9492
9593
|
"meta-refresh": "error",
|
|
9493
9594
|
"multiple-labeled-controls": "error",
|
|
9595
|
+
"no-abstract-role": "error",
|
|
9494
9596
|
"no-autoplay": ["error", { include: ["audio", "video"] }],
|
|
9495
9597
|
"no-dup-id": "error",
|
|
9496
9598
|
"no-implicit-button-type": "error",
|
|
@@ -9570,6 +9672,7 @@ const config$1 = {
|
|
|
9570
9672
|
"map-id-name": "error",
|
|
9571
9673
|
"meta-refresh": "error",
|
|
9572
9674
|
"multiple-labeled-controls": "error",
|
|
9675
|
+
"no-abstract-role": "error",
|
|
9573
9676
|
"no-autoplay": ["error", { include: ["audio", "video"] }],
|
|
9574
9677
|
"no-conditional-comment": "error",
|
|
9575
9678
|
"no-deprecated-attr": "error",
|
|
@@ -9637,6 +9740,7 @@ const config = {
|
|
|
9637
9740
|
"map-dup-name": "error",
|
|
9638
9741
|
"map-id-name": "error",
|
|
9639
9742
|
"multiple-labeled-controls": "error",
|
|
9743
|
+
"no-abstract-role": "error",
|
|
9640
9744
|
"no-deprecated-attr": "error",
|
|
9641
9745
|
"no-dup-attr": "error",
|
|
9642
9746
|
"no-dup-id": "error",
|
|
@@ -11870,7 +11974,7 @@ class HtmlValidate {
|
|
|
11870
11974
|
}
|
|
11871
11975
|
|
|
11872
11976
|
const name = "html-validate";
|
|
11873
|
-
const version = "8.
|
|
11977
|
+
const version = "8.12.0";
|
|
11874
11978
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
11875
11979
|
|
|
11876
11980
|
function definePlugin(plugin) {
|