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.
package/dist/cjs/core.js CHANGED
@@ -6277,7 +6277,7 @@ const defaults$h = {
6277
6277
  minInitialRank: "h1",
6278
6278
  sectioningRoots: ["dialog", '[role="dialog"]', '[role="alertdialog"]']
6279
6279
  };
6280
- function isRelevant$5(event) {
6280
+ function isRelevant$6(event) {
6281
6281
  const node = event.target;
6282
6282
  return Boolean(node.meta && node.meta.heading);
6283
6283
  }
@@ -6344,7 +6344,7 @@ class HeadingLevel extends Rule {
6344
6344
  };
6345
6345
  }
6346
6346
  setup() {
6347
- this.on("tag:start", isRelevant$5, (event) => {
6347
+ this.on("tag:start", isRelevant$6, (event) => {
6348
6348
  this.onTagStart(event);
6349
6349
  });
6350
6350
  this.on("tag:ready", (event) => {
@@ -6984,7 +6984,7 @@ class MapDupName extends Rule {
6984
6984
  }
6985
6985
  }
6986
6986
 
6987
- function isRelevant$4(event) {
6987
+ function isRelevant$5(event) {
6988
6988
  return event.target.is("map");
6989
6989
  }
6990
6990
  function hasStaticValue(attr) {
@@ -6998,7 +6998,7 @@ class MapIdName extends Rule {
6998
6998
  };
6999
6999
  }
7000
7000
  setup() {
7001
- this.on("tag:ready", isRelevant$4, (event) => {
7001
+ this.on("tag:ready", isRelevant$5, (event) => {
7002
7002
  const { target } = event;
7003
7003
  const id = target.getAttribute("id");
7004
7004
  const name = target.getAttribute("name");
@@ -7073,6 +7073,62 @@ class MultipleLabeledControls extends Rule {
7073
7073
  }
7074
7074
  }
7075
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
+
7076
7132
  const defaults$e = {
7077
7133
  include: null,
7078
7134
  exclude: null
@@ -9482,6 +9538,7 @@ const bundledRules = {
9482
9538
  "meta-refresh": MetaRefresh,
9483
9539
  "missing-doctype": MissingDoctype,
9484
9540
  "multiple-labeled-controls": MultipleLabeledControls,
9541
+ "no-abstract-role": NoAbstractRole,
9485
9542
  "no-autoplay": NoAutoplay,
9486
9543
  "no-conditional-comment": NoConditionalComment,
9487
9544
  "no-deprecated-attr": NoDeprecatedAttr,
@@ -9535,6 +9592,7 @@ const config$4 = {
9535
9592
  "hidden-focusable": "error",
9536
9593
  "meta-refresh": "error",
9537
9594
  "multiple-labeled-controls": "error",
9595
+ "no-abstract-role": "error",
9538
9596
  "no-autoplay": ["error", { include: ["audio", "video"] }],
9539
9597
  "no-dup-id": "error",
9540
9598
  "no-implicit-button-type": "error",
@@ -9614,6 +9672,7 @@ const config$1 = {
9614
9672
  "map-id-name": "error",
9615
9673
  "meta-refresh": "error",
9616
9674
  "multiple-labeled-controls": "error",
9675
+ "no-abstract-role": "error",
9617
9676
  "no-autoplay": ["error", { include: ["audio", "video"] }],
9618
9677
  "no-conditional-comment": "error",
9619
9678
  "no-deprecated-attr": "error",
@@ -9681,6 +9740,7 @@ const config = {
9681
9740
  "map-dup-name": "error",
9682
9741
  "map-id-name": "error",
9683
9742
  "multiple-labeled-controls": "error",
9743
+ "no-abstract-role": "error",
9684
9744
  "no-deprecated-attr": "error",
9685
9745
  "no-dup-attr": "error",
9686
9746
  "no-dup-id": "error",
@@ -11914,7 +11974,7 @@ class HtmlValidate {
11914
11974
  }
11915
11975
 
11916
11976
  const name = "html-validate";
11917
- const version = "8.11.1";
11977
+ const version = "8.12.0";
11918
11978
  const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
11919
11979
 
11920
11980
  function definePlugin(plugin) {