html-validate 8.11.1 → 8.13.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.3"
9
9
  }
10
10
  ]
11
11
  }
package/dist/es/core.js CHANGED
@@ -727,6 +727,9 @@ const definitions = {
727
727
  },
728
728
  {
729
729
  $ref: "#/definitions/expression"
730
+ },
731
+ {
732
+ "function": true
730
733
  }
731
734
  ]
732
735
  },
@@ -1365,7 +1368,12 @@ class MetaTable {
1365
1368
  function expandProperties(node, entry) {
1366
1369
  for (const key of dynamicKeys) {
1367
1370
  const property = entry[key];
1368
- if (property && typeof property !== "boolean") {
1371
+ if (!property) {
1372
+ continue;
1373
+ }
1374
+ if (typeof property === "function") {
1375
+ setMetaProperty(entry, key, property(node._adapter));
1376
+ } else if (typeof property !== "boolean") {
1369
1377
  setMetaProperty(entry, key, evaluateProperty(node, property));
1370
1378
  }
1371
1379
  }
@@ -6267,7 +6275,7 @@ const defaults$h = {
6267
6275
  minInitialRank: "h1",
6268
6276
  sectioningRoots: ["dialog", '[role="dialog"]', '[role="alertdialog"]']
6269
6277
  };
6270
- function isRelevant$5(event) {
6278
+ function isRelevant$6(event) {
6271
6279
  const node = event.target;
6272
6280
  return Boolean(node.meta && node.meta.heading);
6273
6281
  }
@@ -6334,7 +6342,7 @@ class HeadingLevel extends Rule {
6334
6342
  };
6335
6343
  }
6336
6344
  setup() {
6337
- this.on("tag:start", isRelevant$5, (event) => {
6345
+ this.on("tag:start", isRelevant$6, (event) => {
6338
6346
  this.onTagStart(event);
6339
6347
  });
6340
6348
  this.on("tag:ready", (event) => {
@@ -6974,7 +6982,7 @@ class MapDupName extends Rule {
6974
6982
  }
6975
6983
  }
6976
6984
 
6977
- function isRelevant$4(event) {
6985
+ function isRelevant$5(event) {
6978
6986
  return event.target.is("map");
6979
6987
  }
6980
6988
  function hasStaticValue(attr) {
@@ -6988,7 +6996,7 @@ class MapIdName extends Rule {
6988
6996
  };
6989
6997
  }
6990
6998
  setup() {
6991
- this.on("tag:ready", isRelevant$4, (event) => {
6999
+ this.on("tag:ready", isRelevant$5, (event) => {
6992
7000
  const { target } = event;
6993
7001
  const id = target.getAttribute("id");
6994
7002
  const name = target.getAttribute("name");
@@ -7063,6 +7071,62 @@ class MultipleLabeledControls extends Rule {
7063
7071
  }
7064
7072
  }
7065
7073
 
7074
+ const abstractRoles = [
7075
+ "command",
7076
+ "composite",
7077
+ "input",
7078
+ "landmark",
7079
+ "range",
7080
+ "roletype",
7081
+ "section",
7082
+ "sectionhead",
7083
+ "select",
7084
+ "structure",
7085
+ "widget",
7086
+ "window"
7087
+ ];
7088
+ function isRelevant$4(event) {
7089
+ return event.key === "role";
7090
+ }
7091
+ class NoAbstractRole extends Rule {
7092
+ documentation(context) {
7093
+ return {
7094
+ description: [
7095
+ `Role \`"${context.role}"\` is abstract and must not be used.`,
7096
+ "",
7097
+ "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:",
7098
+ "",
7099
+ ...abstractRoles.map((it) => `- \`"${it}"\``),
7100
+ "",
7101
+ `Use one of the defined subclass roles for \`"${context.role}"\` instead.`
7102
+ ].join("\n"),
7103
+ url: "https://html-validate.org/rules/no-abstract-role.html"
7104
+ };
7105
+ }
7106
+ setup() {
7107
+ this.on("attr", isRelevant$4, (event) => {
7108
+ const roles = event.value;
7109
+ if (!roles || roles instanceof DynamicValue) {
7110
+ return;
7111
+ }
7112
+ const tokens = new DOMTokenList(roles, event.valueLocation);
7113
+ for (const { item: role, location } of tokens.iterator()) {
7114
+ if (!abstractRoles.includes(role)) {
7115
+ continue;
7116
+ }
7117
+ this.report({
7118
+ node: event.target,
7119
+ message: `Role "{{ role }}" is abstract and must not be used`,
7120
+ location,
7121
+ context: {
7122
+ role
7123
+ }
7124
+ });
7125
+ }
7126
+ });
7127
+ }
7128
+ }
7129
+
7066
7130
  const defaults$e = {
7067
7131
  include: null,
7068
7132
  exclude: null
@@ -9472,6 +9536,7 @@ const bundledRules = {
9472
9536
  "meta-refresh": MetaRefresh,
9473
9537
  "missing-doctype": MissingDoctype,
9474
9538
  "multiple-labeled-controls": MultipleLabeledControls,
9539
+ "no-abstract-role": NoAbstractRole,
9475
9540
  "no-autoplay": NoAutoplay,
9476
9541
  "no-conditional-comment": NoConditionalComment,
9477
9542
  "no-deprecated-attr": NoDeprecatedAttr,
@@ -9525,6 +9590,7 @@ const config$4 = {
9525
9590
  "hidden-focusable": "error",
9526
9591
  "meta-refresh": "error",
9527
9592
  "multiple-labeled-controls": "error",
9593
+ "no-abstract-role": "error",
9528
9594
  "no-autoplay": ["error", { include: ["audio", "video"] }],
9529
9595
  "no-dup-id": "error",
9530
9596
  "no-implicit-button-type": "error",
@@ -9604,6 +9670,7 @@ const config$1 = {
9604
9670
  "map-id-name": "error",
9605
9671
  "meta-refresh": "error",
9606
9672
  "multiple-labeled-controls": "error",
9673
+ "no-abstract-role": "error",
9607
9674
  "no-autoplay": ["error", { include: ["audio", "video"] }],
9608
9675
  "no-conditional-comment": "error",
9609
9676
  "no-deprecated-attr": "error",
@@ -9671,6 +9738,7 @@ const config = {
9671
9738
  "map-dup-name": "error",
9672
9739
  "map-id-name": "error",
9673
9740
  "multiple-labeled-controls": "error",
9741
+ "no-abstract-role": "error",
9674
9742
  "no-deprecated-attr": "error",
9675
9743
  "no-dup-attr": "error",
9676
9744
  "no-dup-id": "error",
@@ -11904,7 +11972,7 @@ class HtmlValidate {
11904
11972
  }
11905
11973
 
11906
11974
  const name = "html-validate";
11907
- const version = "8.11.1";
11975
+ const version = "8.13.0";
11908
11976
  const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
11909
11977
 
11910
11978
  function definePlugin(plugin) {