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.
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.40.6"
8
+ "packageVersion": "7.42.2"
9
9
  }
10
10
  ]
11
11
  }
package/dist/es/core.js CHANGED
@@ -1953,6 +1953,55 @@ function factory$1(name, context) {
1953
1953
  }
1954
1954
  }
1955
1955
 
1956
+ const escapedCodepoints = ["9", "a", "d"];
1957
+ function* splitSelectorElements(selector) {
1958
+ let begin = 0;
1959
+ let end = 0;
1960
+ function initialState(ch, p) {
1961
+ if (ch === "\\") {
1962
+ return 1 /* ESCAPED */;
1963
+ }
1964
+ if (ch === " ") {
1965
+ end = p;
1966
+ return 2 /* WHITESPACE */;
1967
+ }
1968
+ return 0 /* INITIAL */;
1969
+ }
1970
+ function escapedState(ch) {
1971
+ if (escapedCodepoints.includes(ch)) {
1972
+ return 1 /* ESCAPED */;
1973
+ }
1974
+ return 0 /* INITIAL */;
1975
+ }
1976
+ function* whitespaceState(ch, p) {
1977
+ if (ch === " ") {
1978
+ return 2 /* WHITESPACE */;
1979
+ }
1980
+ yield selector.slice(begin, end);
1981
+ begin = p;
1982
+ end = p;
1983
+ return 0 /* INITIAL */;
1984
+ }
1985
+ let state = 0 /* INITIAL */;
1986
+ for (let p = 0; p < selector.length; p++) {
1987
+ const ch = selector[p];
1988
+ switch (state) {
1989
+ case 0 /* INITIAL */:
1990
+ state = initialState(ch, p);
1991
+ break;
1992
+ case 1 /* ESCAPED */:
1993
+ state = escapedState(ch);
1994
+ break;
1995
+ case 2 /* WHITESPACE */:
1996
+ state = yield* whitespaceState(ch, p);
1997
+ break;
1998
+ }
1999
+ }
2000
+ if (begin !== selector.length) {
2001
+ yield selector.slice(begin);
2002
+ }
2003
+ }
2004
+
1956
2005
  function stripslashes(value) {
1957
2006
  return value.replace(/\\(.)/g, "$1");
1958
2007
  }
@@ -2152,13 +2201,8 @@ class Selector {
2152
2201
  }
2153
2202
  static parse(selector) {
2154
2203
  selector = selector.replace(/([+~>]) /g, "$1");
2155
- let begin = 0;
2156
- const delimiter = /((?:[^\\\u0039\u0061\u0064]) +|$)/g;
2157
- return Array.from(selector.matchAll(delimiter), (match) => {
2158
- const end = match.index + 1;
2159
- const part = unescapeCodepoint(selector.slice(begin, end));
2160
- begin = end + 1;
2161
- return new Pattern(part);
2204
+ return Array.from(splitSelectorElements(selector), (element) => {
2205
+ return new Pattern(unescapeCodepoint(element));
2162
2206
  });
2163
2207
  }
2164
2208
  static findCandidates(root, pattern) {
@@ -6223,7 +6267,7 @@ const defaults$h = {
6223
6267
  minInitialRank: "h1",
6224
6268
  sectioningRoots: ["dialog", '[role="dialog"]', '[role="alertdialog"]']
6225
6269
  };
6226
- function isRelevant$5(event) {
6270
+ function isRelevant$6(event) {
6227
6271
  const node = event.target;
6228
6272
  return Boolean(node.meta && node.meta.heading);
6229
6273
  }
@@ -6290,7 +6334,7 @@ class HeadingLevel extends Rule {
6290
6334
  };
6291
6335
  }
6292
6336
  setup() {
6293
- this.on("tag:start", isRelevant$5, (event) => {
6337
+ this.on("tag:start", isRelevant$6, (event) => {
6294
6338
  this.onTagStart(event);
6295
6339
  });
6296
6340
  this.on("tag:ready", (event) => {
@@ -6930,7 +6974,7 @@ class MapDupName extends Rule {
6930
6974
  }
6931
6975
  }
6932
6976
 
6933
- function isRelevant$4(event) {
6977
+ function isRelevant$5(event) {
6934
6978
  return event.target.is("map");
6935
6979
  }
6936
6980
  function hasStaticValue(attr) {
@@ -6944,7 +6988,7 @@ class MapIdName extends Rule {
6944
6988
  };
6945
6989
  }
6946
6990
  setup() {
6947
- this.on("tag:ready", isRelevant$4, (event) => {
6991
+ this.on("tag:ready", isRelevant$5, (event) => {
6948
6992
  const { target } = event;
6949
6993
  const id = target.getAttribute("id");
6950
6994
  const name = target.getAttribute("name");
@@ -7019,6 +7063,62 @@ class MultipleLabeledControls extends Rule {
7019
7063
  }
7020
7064
  }
7021
7065
 
7066
+ const abstractRoles = [
7067
+ "command",
7068
+ "composite",
7069
+ "input",
7070
+ "landmark",
7071
+ "range",
7072
+ "roletype",
7073
+ "section",
7074
+ "sectionhead",
7075
+ "select",
7076
+ "structure",
7077
+ "widget",
7078
+ "window"
7079
+ ];
7080
+ function isRelevant$4(event) {
7081
+ return event.key === "role";
7082
+ }
7083
+ class NoAbstractRole extends Rule {
7084
+ documentation(context) {
7085
+ return {
7086
+ description: [
7087
+ `Role \`"${context.role}"\` is abstract and must not be used.`,
7088
+ "",
7089
+ "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:",
7090
+ "",
7091
+ ...abstractRoles.map((it) => `- \`"${it}"\``),
7092
+ "",
7093
+ `Use one of the defined subclass roles for \`"${context.role}"\` instead.`
7094
+ ].join("\n"),
7095
+ url: "https://html-validate.org/rules/no-abstract-role.html"
7096
+ };
7097
+ }
7098
+ setup() {
7099
+ this.on("attr", isRelevant$4, (event) => {
7100
+ const roles = event.value;
7101
+ if (!roles || roles instanceof DynamicValue) {
7102
+ return;
7103
+ }
7104
+ const tokens = new DOMTokenList(roles, event.valueLocation);
7105
+ for (const { item: role, location } of tokens.iterator()) {
7106
+ if (!abstractRoles.includes(role)) {
7107
+ continue;
7108
+ }
7109
+ this.report({
7110
+ node: event.target,
7111
+ message: `Role "{{ role }}" is abstract and must not be used`,
7112
+ location,
7113
+ context: {
7114
+ role
7115
+ }
7116
+ });
7117
+ }
7118
+ });
7119
+ }
7120
+ }
7121
+
7022
7122
  const defaults$e = {
7023
7123
  include: null,
7024
7124
  exclude: null
@@ -9428,6 +9528,7 @@ const bundledRules = {
9428
9528
  "meta-refresh": MetaRefresh,
9429
9529
  "missing-doctype": MissingDoctype,
9430
9530
  "multiple-labeled-controls": MultipleLabeledControls,
9531
+ "no-abstract-role": NoAbstractRole,
9431
9532
  "no-autoplay": NoAutoplay,
9432
9533
  "no-conditional-comment": NoConditionalComment,
9433
9534
  "no-deprecated-attr": NoDeprecatedAttr,
@@ -9481,6 +9582,7 @@ const config$4 = {
9481
9582
  "hidden-focusable": "error",
9482
9583
  "meta-refresh": "error",
9483
9584
  "multiple-labeled-controls": "error",
9585
+ "no-abstract-role": "error",
9484
9586
  "no-autoplay": ["error", { include: ["audio", "video"] }],
9485
9587
  "no-dup-id": "error",
9486
9588
  "no-implicit-button-type": "error",
@@ -9560,6 +9662,7 @@ const config$1 = {
9560
9662
  "map-id-name": "error",
9561
9663
  "meta-refresh": "error",
9562
9664
  "multiple-labeled-controls": "error",
9665
+ "no-abstract-role": "error",
9563
9666
  "no-autoplay": ["error", { include: ["audio", "video"] }],
9564
9667
  "no-conditional-comment": "error",
9565
9668
  "no-deprecated-attr": "error",
@@ -9627,6 +9730,7 @@ const config = {
9627
9730
  "map-dup-name": "error",
9628
9731
  "map-id-name": "error",
9629
9732
  "multiple-labeled-controls": "error",
9733
+ "no-abstract-role": "error",
9630
9734
  "no-deprecated-attr": "error",
9631
9735
  "no-dup-attr": "error",
9632
9736
  "no-dup-id": "error",
@@ -11860,7 +11964,7 @@ class HtmlValidate {
11860
11964
  }
11861
11965
 
11862
11966
  const name = "html-validate";
11863
- const version = "8.11.0";
11967
+ const version = "8.12.0";
11864
11968
  const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
11865
11969
 
11866
11970
  function definePlugin(plugin) {