html-validate 9.5.2 → 9.5.3

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/es/core.js CHANGED
@@ -1369,6 +1369,9 @@ class DynamicValue {
1369
1369
  }
1370
1370
  }
1371
1371
 
1372
+ function isStaticAttribute(attr) {
1373
+ return Boolean(attr?.isStatic);
1374
+ }
1372
1375
  function isDynamicAttribute(attr) {
1373
1376
  return Boolean(attr?.isDynamic);
1374
1377
  }
@@ -1998,7 +2001,7 @@ class AttributeCondition extends Condition {
1998
2001
  const [, key, op, value] = /^(.+?)(?:([~^$*|]?=)"([^"]+?)")?$/.exec(attr);
1999
2002
  this.key = key;
2000
2003
  this.op = op;
2001
- this.value = value;
2004
+ this.value = typeof value === "string" ? stripslashes(value) : value;
2002
2005
  }
2003
2006
  match(node) {
2004
2007
  const attr = node.getAttribute(this.key, true);
@@ -2631,9 +2634,7 @@ class HtmlElement extends DOMNode {
2631
2634
  * the subsequent `dom:ready` event).
2632
2635
  */
2633
2636
  loadMeta(meta) {
2634
- if (!this.metaElement) {
2635
- this.metaElement = {};
2636
- }
2637
+ this.metaElement ??= {};
2637
2638
  for (const key of MetaCopyableProperty) {
2638
2639
  const value = meta[key];
2639
2640
  if (typeof value !== "undefined") {
@@ -8011,7 +8012,7 @@ const ARIA = [
8011
8012
  { property: "aria-owns", isList: true }
8012
8013
  ];
8013
8014
  function idMissing(document, id) {
8014
- const nodes = document.querySelectorAll(`[id="${id}"]`);
8015
+ const nodes = document.querySelectorAll(generateIdSelector(id));
8015
8016
  return nodes.length === 0;
8016
8017
  }
8017
8018
  class NoMissingReferences extends Rule {
@@ -8229,15 +8230,14 @@ class NoRedundantFor extends Rule {
8229
8230
  return;
8230
8231
  }
8231
8232
  const attr = target.getAttribute("for");
8232
- if (!attr || attr.isDynamic) {
8233
+ if (!attr || !isStaticAttribute(attr)) {
8233
8234
  return;
8234
8235
  }
8235
8236
  const id = attr.value;
8236
8237
  if (!id) {
8237
8238
  return;
8238
8239
  }
8239
- const escaped = escapeSelectorComponent(id);
8240
- const control = target.querySelector(`[id="${escaped}"]`);
8240
+ const control = target.querySelector(generateIdSelector(id));
8241
8241
  if (!control) {
8242
8242
  return;
8243
8243
  }
@@ -11720,7 +11720,7 @@ class EventHandler {
11720
11720
  }
11721
11721
 
11722
11722
  const name = "html-validate";
11723
- const version = "9.5.2";
11723
+ const version = "9.5.3";
11724
11724
  const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
11725
11725
 
11726
11726
  function freeze(src) {
@@ -12653,9 +12653,7 @@ class Engine {
12653
12653
  rule.block(blocker);
12654
12654
  }
12655
12655
  const unregisterOpen = parser.on("tag:start", (_event, data) => {
12656
- if (directiveBlock === null) {
12657
- directiveBlock = data.target.parent?.unique ?? null;
12658
- }
12656
+ directiveBlock ??= data.target.parent?.unique ?? null;
12659
12657
  data.target.blockRules(ruleIds, blocker);
12660
12658
  });
12661
12659
  const unregisterClose = parser.on("tag:end", (_event, data) => {