html-validate 8.11.1 → 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.41.0"
8
+ "packageVersion": "7.42.2"
9
9
  }
10
10
  ]
11
11
  }
package/dist/es/core.js CHANGED
@@ -6267,7 +6267,7 @@ const defaults$h = {
6267
6267
  minInitialRank: "h1",
6268
6268
  sectioningRoots: ["dialog", '[role="dialog"]', '[role="alertdialog"]']
6269
6269
  };
6270
- function isRelevant$5(event) {
6270
+ function isRelevant$6(event) {
6271
6271
  const node = event.target;
6272
6272
  return Boolean(node.meta && node.meta.heading);
6273
6273
  }
@@ -6334,7 +6334,7 @@ class HeadingLevel extends Rule {
6334
6334
  };
6335
6335
  }
6336
6336
  setup() {
6337
- this.on("tag:start", isRelevant$5, (event) => {
6337
+ this.on("tag:start", isRelevant$6, (event) => {
6338
6338
  this.onTagStart(event);
6339
6339
  });
6340
6340
  this.on("tag:ready", (event) => {
@@ -6974,7 +6974,7 @@ class MapDupName extends Rule {
6974
6974
  }
6975
6975
  }
6976
6976
 
6977
- function isRelevant$4(event) {
6977
+ function isRelevant$5(event) {
6978
6978
  return event.target.is("map");
6979
6979
  }
6980
6980
  function hasStaticValue(attr) {
@@ -6988,7 +6988,7 @@ class MapIdName extends Rule {
6988
6988
  };
6989
6989
  }
6990
6990
  setup() {
6991
- this.on("tag:ready", isRelevant$4, (event) => {
6991
+ this.on("tag:ready", isRelevant$5, (event) => {
6992
6992
  const { target } = event;
6993
6993
  const id = target.getAttribute("id");
6994
6994
  const name = target.getAttribute("name");
@@ -7063,6 +7063,62 @@ class MultipleLabeledControls extends Rule {
7063
7063
  }
7064
7064
  }
7065
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
+
7066
7122
  const defaults$e = {
7067
7123
  include: null,
7068
7124
  exclude: null
@@ -9472,6 +9528,7 @@ const bundledRules = {
9472
9528
  "meta-refresh": MetaRefresh,
9473
9529
  "missing-doctype": MissingDoctype,
9474
9530
  "multiple-labeled-controls": MultipleLabeledControls,
9531
+ "no-abstract-role": NoAbstractRole,
9475
9532
  "no-autoplay": NoAutoplay,
9476
9533
  "no-conditional-comment": NoConditionalComment,
9477
9534
  "no-deprecated-attr": NoDeprecatedAttr,
@@ -9525,6 +9582,7 @@ const config$4 = {
9525
9582
  "hidden-focusable": "error",
9526
9583
  "meta-refresh": "error",
9527
9584
  "multiple-labeled-controls": "error",
9585
+ "no-abstract-role": "error",
9528
9586
  "no-autoplay": ["error", { include: ["audio", "video"] }],
9529
9587
  "no-dup-id": "error",
9530
9588
  "no-implicit-button-type": "error",
@@ -9604,6 +9662,7 @@ const config$1 = {
9604
9662
  "map-id-name": "error",
9605
9663
  "meta-refresh": "error",
9606
9664
  "multiple-labeled-controls": "error",
9665
+ "no-abstract-role": "error",
9607
9666
  "no-autoplay": ["error", { include: ["audio", "video"] }],
9608
9667
  "no-conditional-comment": "error",
9609
9668
  "no-deprecated-attr": "error",
@@ -9671,6 +9730,7 @@ const config = {
9671
9730
  "map-dup-name": "error",
9672
9731
  "map-id-name": "error",
9673
9732
  "multiple-labeled-controls": "error",
9733
+ "no-abstract-role": "error",
9674
9734
  "no-deprecated-attr": "error",
9675
9735
  "no-dup-attr": "error",
9676
9736
  "no-dup-id": "error",
@@ -11904,7 +11964,7 @@ class HtmlValidate {
11904
11964
  }
11905
11965
 
11906
11966
  const name = "html-validate";
11907
- const version = "8.11.1";
11967
+ const version = "8.12.0";
11908
11968
  const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
11909
11969
 
11910
11970
  function definePlugin(plugin) {