html-validate 10.6.0 → 10.7.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.
@@ -1,5 +1,5 @@
1
1
  export { H as HtmlValidate, c as compatibilityCheck, e as esmResolver } from './core-browser.js';
2
- export { A as Attribute, C as Config, a as ConfigError, b as ConfigLoader, D as DOMNode, h as DOMTokenList, j as DOMTree, k as DynamicValue, I as EventHandler, H as HtmlElement, M as MetaCopyableProperty, q as MetaTable, m as NestedError, N as NodeClosed, l as NodeType, P as Parser, B as Reporter, R as ResolvedConfig, t as Rule, n as SchemaValidationError, S as Severity, f as StaticConfigLoader, u as TextClassification, r as TextContent, T as TextNode, U as UserError, V as Validator, W as WrappedError, w as ariaNaming, x as classifyNodeText, p as configPresets, c as defineConfig, E as definePlugin, o as isUserError, y as keywordPatternMatcher, F as ruleExists, z as sliceLocation, s as staticResolver, v as version, G as walk } from './core.js';
2
+ export { A as Attribute, f as Config, e as ConfigError, C as ConfigLoader, D as DOMNode, r as DOMTokenList, u as DOMTree, w as DynamicValue, _ as EventHandler, H as HtmlElement, M as MetaCopyableProperty, F as MetaTable, y as NestedError, N as NodeClosed, x as NodeType, P as Parser, R as Reporter, m as ResolvedConfig, I as Rule, z as SchemaValidationError, o as Severity, S as StaticConfigLoader, J as TextClassification, G as TextContent, T as TextNode, U as UserError, V as Validator, W as WrappedError, K as ariaNaming, L as classifyNodeText, p as configPresets, q as defineConfig, X as definePlugin, B as isUserError, O as keywordPatternMatcher, Y as ruleExists, Q as sliceLocation, s as staticResolver, v as version, Z as walk } from './core.js';
3
3
  export { d as defineMetadata, m as metadataHelper } from './meta-helper.js';
4
4
  import 'ajv';
5
5
  import './elements.js';
package/dist/esm/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { l as legacyRequire, F as FileSystemConfigLoader, e as esmResolver, H as HtmlValidate } from './core-nodejs.js';
2
- import { g as getFormatter$1, U as UserError, e as ensureError, d as deepmerge, i as ignore, B as Reporter, J as engines } from './core.js';
2
+ import { h as getFormatter$1, U as UserError, j as ensureError, k as deepmerge, l as ignore, R as Reporter, $ as engines } from './core.js';
3
3
  import path$1 from 'node:path/posix';
4
4
  import fs from 'node:fs';
5
5
  import path from 'node:path';
@@ -1,4 +1,4 @@
1
- import { f as StaticConfigLoader, K as normalizeSource, L as transformSource, O as Engine, P as Parser, Q as transformSourceSync, X as transformFilename, Y as transformFilenameSync, B as Reporter, Z as configurationSchema, _ as isThenable, U as UserError, b as ConfigLoader, $ as compatibilityCheckImpl, v as version } from './core.js';
1
+ import { S as StaticConfigLoader, n as normalizeSource, t as transformSource, E as Engine, P as Parser, a as transformSourceSync, b as transformFilename, c as transformFilenameSync, R as Reporter, d as configurationSchema, i as isThenable, U as UserError, C as ConfigLoader, g as compatibilityCheckImpl, v as version } from './core.js';
2
2
 
3
3
  function isSourceHooks(value) {
4
4
  if (!value || typeof value === "string") {
@@ -1,5 +1,5 @@
1
1
  import fs, { existsSync } from 'node:fs';
2
- import { f as StaticConfigLoader, K as normalizeSource, L as transformSource, O as Engine, P as Parser, Q as transformSourceSync, X as transformFilename, Y as transformFilenameSync, B as Reporter, Z as configurationSchema, _ as isThenable, U as UserError, b as ConfigLoader, a as ConfigError, C as Config, $ as compatibilityCheckImpl, v as version } from './core.js';
2
+ import { S as StaticConfigLoader, n as normalizeSource, t as transformSource, E as Engine, P as Parser, a as transformSourceSync, b as transformFilename, c as transformFilenameSync, R as Reporter, d as configurationSchema, i as isThenable, U as UserError, C as ConfigLoader, e as ConfigError, f as Config, g as compatibilityCheckImpl, v as version } from './core.js';
3
3
  import path from 'node:path';
4
4
  import fs$1 from 'node:fs/promises';
5
5
  import { pathToFileURL } from 'node:url';
package/dist/esm/core.js CHANGED
@@ -3999,7 +3999,7 @@ class Rule {
3999
3999
  }
4000
4000
  }
4001
4001
 
4002
- const defaults$y = {
4002
+ const defaults$z = {
4003
4003
  allowExternal: true,
4004
4004
  allowRelative: true,
4005
4005
  allowAbsolute: true,
@@ -4043,7 +4043,7 @@ class AllowedLinks extends Rule {
4043
4043
  allowRelative;
4044
4044
  allowAbsolute;
4045
4045
  constructor(options) {
4046
- super({ ...defaults$y, ...options });
4046
+ super({ ...defaults$z, ...options });
4047
4047
  this.allowExternal = parseAllow(this.options.allowExternal);
4048
4048
  this.allowRelative = parseAllow(this.options.allowRelative);
4049
4049
  this.allowAbsolute = parseAllow(this.options.allowAbsolute);
@@ -4211,7 +4211,7 @@ class AllowedLinks extends Rule {
4211
4211
  }
4212
4212
  }
4213
4213
 
4214
- const defaults$x = {
4214
+ const defaults$y = {
4215
4215
  accessible: true
4216
4216
  };
4217
4217
  function findByTarget(target, siblings) {
@@ -4241,7 +4241,7 @@ function getDescription$1(context) {
4241
4241
  }
4242
4242
  class AreaAlt extends Rule {
4243
4243
  constructor(options) {
4244
- super({ ...defaults$x, ...options });
4244
+ super({ ...defaults$y, ...options });
4245
4245
  }
4246
4246
  static schema() {
4247
4247
  return {
@@ -4320,8 +4320,12 @@ class AriaHiddenBody extends Rule {
4320
4320
  }
4321
4321
  }
4322
4322
 
4323
- const defaults$w = {
4324
- allowAnyNamable: false
4323
+ const defaults$x = {
4324
+ allowAnyNamable: false,
4325
+ elements: {
4326
+ include: null,
4327
+ exclude: null
4328
+ }
4325
4329
  };
4326
4330
  const allowlist = /* @__PURE__ */ new Set([
4327
4331
  "main",
@@ -4364,7 +4368,26 @@ function isValidUsage(target, meta) {
4364
4368
  }
4365
4369
  class AriaLabelMisuse extends Rule {
4366
4370
  constructor(options) {
4367
- super({ ...defaults$w, ...options });
4371
+ super({ ...defaults$x, ...options });
4372
+ }
4373
+ static schema() {
4374
+ return {
4375
+ allowAnyNamable: {
4376
+ type: "boolean"
4377
+ },
4378
+ elements: {
4379
+ type: "object",
4380
+ properties: {
4381
+ include: {
4382
+ anyOf: [{ type: "array", items: { type: "string" } }, { type: "null" }]
4383
+ },
4384
+ exclude: {
4385
+ anyOf: [{ type: "array", items: { type: "string" } }, { type: "null" }]
4386
+ }
4387
+ },
4388
+ additionalProperties: false
4389
+ }
4390
+ };
4368
4391
  }
4369
4392
  documentation(context) {
4370
4393
  const valid = [
@@ -4422,6 +4445,9 @@ class AriaLabelMisuse extends Rule {
4422
4445
  if (!meta) {
4423
4446
  return;
4424
4447
  }
4448
+ if (this.shouldIgnoreElement(target)) {
4449
+ return;
4450
+ }
4425
4451
  if (isValidUsage(target, meta)) {
4426
4452
  return;
4427
4453
  }
@@ -4446,6 +4472,9 @@ class AriaLabelMisuse extends Rule {
4446
4472
  });
4447
4473
  }
4448
4474
  }
4475
+ shouldIgnoreElement(target) {
4476
+ return isKeywordIgnored(this.options.elements, target.tagName, keywordPatternMatcher);
4477
+ }
4449
4478
  }
4450
4479
 
4451
4480
  class ConfigError extends UserError {
@@ -4508,14 +4537,14 @@ class CaseStyle {
4508
4537
  }
4509
4538
  }
4510
4539
 
4511
- const defaults$v = {
4540
+ const defaults$w = {
4512
4541
  style: "lowercase",
4513
4542
  ignoreForeign: true
4514
4543
  };
4515
4544
  class AttrCase extends Rule {
4516
4545
  style;
4517
4546
  constructor(options) {
4518
- super({ ...defaults$v, ...options });
4547
+ super({ ...defaults$w, ...options });
4519
4548
  this.style = new CaseStyle(this.options.style, "attr-case");
4520
4549
  }
4521
4550
  static schema() {
@@ -4622,7 +4651,7 @@ const MATCH_TEXTAREA_DATA = /^[^]*?(?=<\/textarea)/;
4622
4651
  const MATCH_TEXTAREA_END = /^<(\/)(textarea)/;
4623
4652
  const MATCH_TITLE_DATA = /^[^]*?(?=<\/title)/;
4624
4653
  const MATCH_TITLE_END = /^<(\/)(title)/;
4625
- const MATCH_DIRECTIVE = /^(<!--\s*\[html-validate-)([a-z0-9-]+)(\s*)(.*?)(]?\s*-->)/;
4654
+ const MATCH_DIRECTIVE = /^(<!--\s*\[?)(html-validate-)([a-z0-9-]+)(\s*)(.*?)(]?\s*-->)/;
4626
4655
  const MATCH_COMMENT = /^<!--([^]*?)-->/;
4627
4656
  const MATCH_CONDITIONAL = /^<!\[([^\]]*?)\]>/;
4628
4657
  class InvalidTokenError extends Error {
@@ -4920,7 +4949,7 @@ class AttrDelimiter extends Rule {
4920
4949
  }
4921
4950
 
4922
4951
  const DEFAULT_PATTERN = "[a-z0-9-:]+";
4923
- const defaults$u = {
4952
+ const defaults$v = {
4924
4953
  pattern: DEFAULT_PATTERN,
4925
4954
  ignoreForeign: true
4926
4955
  };
@@ -4953,7 +4982,7 @@ function generateDescription(name, pattern) {
4953
4982
  class AttrPattern extends Rule {
4954
4983
  pattern;
4955
4984
  constructor(options) {
4956
- super({ ...defaults$u, ...options });
4985
+ super({ ...defaults$v, ...options });
4957
4986
  this.pattern = generateRegexp(this.options.pattern);
4958
4987
  }
4959
4988
  static schema() {
@@ -5000,7 +5029,7 @@ class AttrPattern extends Rule {
5000
5029
  }
5001
5030
  }
5002
5031
 
5003
- const defaults$t = {
5032
+ const defaults$u = {
5004
5033
  style: "auto",
5005
5034
  unquoted: false
5006
5035
  };
@@ -5066,7 +5095,7 @@ class AttrQuotes extends Rule {
5066
5095
  };
5067
5096
  }
5068
5097
  constructor(options) {
5069
- super({ ...defaults$t, ...options });
5098
+ super({ ...defaults$u, ...options });
5070
5099
  this.style = parseStyle$3(this.options.style);
5071
5100
  }
5072
5101
  setup() {
@@ -5222,13 +5251,13 @@ class AttributeAllowedValues extends Rule {
5222
5251
  }
5223
5252
  }
5224
5253
 
5225
- const defaults$s = {
5254
+ const defaults$t = {
5226
5255
  style: "omit"
5227
5256
  };
5228
5257
  class AttributeBooleanStyle extends Rule {
5229
5258
  hasInvalidStyle;
5230
5259
  constructor(options) {
5231
- super({ ...defaults$s, ...options });
5260
+ super({ ...defaults$t, ...options });
5232
5261
  this.hasInvalidStyle = parseStyle$2(this.options.style);
5233
5262
  }
5234
5263
  static schema() {
@@ -5298,13 +5327,13 @@ function reportMessage$1(attr, style) {
5298
5327
  return "";
5299
5328
  }
5300
5329
 
5301
- const defaults$r = {
5330
+ const defaults$s = {
5302
5331
  style: "omit"
5303
5332
  };
5304
5333
  class AttributeEmptyStyle extends Rule {
5305
5334
  hasInvalidStyle;
5306
5335
  constructor(options) {
5307
- super({ ...defaults$r, ...options });
5336
+ super({ ...defaults$s, ...options });
5308
5337
  this.hasInvalidStyle = parseStyle$1(this.options.style);
5309
5338
  }
5310
5339
  static schema() {
@@ -5552,7 +5581,7 @@ class BasePatternRule extends Rule {
5552
5581
  }
5553
5582
  }
5554
5583
 
5555
- const defaults$q = {
5584
+ const defaults$r = {
5556
5585
  pattern: "kebabcase"
5557
5586
  };
5558
5587
  class ClassPattern extends BasePatternRule {
@@ -5560,7 +5589,7 @@ class ClassPattern extends BasePatternRule {
5560
5589
  super({
5561
5590
  ruleId: "class-pattern",
5562
5591
  attr: "class",
5563
- options: { ...defaults$q, ...options },
5592
+ options: { ...defaults$r, ...options },
5564
5593
  allowedPatterns: patternNames
5565
5594
  // allow all patterns
5566
5595
  });
@@ -5710,13 +5739,13 @@ class CloseOrder extends Rule {
5710
5739
  }
5711
5740
  }
5712
5741
 
5713
- const defaults$p = {
5742
+ const defaults$q = {
5714
5743
  include: null,
5715
5744
  exclude: null
5716
5745
  };
5717
5746
  class Deprecated extends Rule {
5718
5747
  constructor(options) {
5719
- super({ ...defaults$p, ...options });
5748
+ super({ ...defaults$q, ...options });
5720
5749
  }
5721
5750
  static schema() {
5722
5751
  return {
@@ -5870,12 +5899,12 @@ let NoStyleTag$1 = class NoStyleTag extends Rule {
5870
5899
  }
5871
5900
  };
5872
5901
 
5873
- const defaults$o = {
5902
+ const defaults$p = {
5874
5903
  style: "uppercase"
5875
5904
  };
5876
5905
  class DoctypeStyle extends Rule {
5877
5906
  constructor(options) {
5878
- super({ ...defaults$o, ...options });
5907
+ super({ ...defaults$p, ...options });
5879
5908
  }
5880
5909
  static schema() {
5881
5910
  return {
@@ -5903,13 +5932,13 @@ class DoctypeStyle extends Rule {
5903
5932
  }
5904
5933
  }
5905
5934
 
5906
- const defaults$n = {
5935
+ const defaults$o = {
5907
5936
  style: "lowercase"
5908
5937
  };
5909
5938
  class ElementCase extends Rule {
5910
5939
  style;
5911
5940
  constructor(options) {
5912
- super({ ...defaults$n, ...options });
5941
+ super({ ...defaults$o, ...options });
5913
5942
  this.style = new CaseStyle(this.options.style, "element-case");
5914
5943
  }
5915
5944
  static schema() {
@@ -5969,7 +5998,7 @@ class ElementCase extends Rule {
5969
5998
  }
5970
5999
  }
5971
6000
 
5972
- const defaults$m = {
6001
+ const defaults$n = {
5973
6002
  pattern: "^[a-z][a-z0-9\\-._]*-[a-z0-9\\-._]*$",
5974
6003
  whitelist: [],
5975
6004
  blacklist: []
@@ -5977,7 +6006,7 @@ const defaults$m = {
5977
6006
  class ElementName extends Rule {
5978
6007
  pattern;
5979
6008
  constructor(options) {
5980
- super({ ...defaults$m, ...options });
6009
+ super({ ...defaults$n, ...options });
5981
6010
  this.pattern = new RegExp(this.options.pattern);
5982
6011
  }
5983
6012
  static schema() {
@@ -6014,7 +6043,7 @@ class ElementName extends Rule {
6014
6043
  ...context.blacklist.map((cur) => `- ${cur}`)
6015
6044
  ];
6016
6045
  }
6017
- if (context.pattern !== defaults$m.pattern) {
6046
+ if (context.pattern !== defaults$n.pattern) {
6018
6047
  return [
6019
6048
  `<${context.tagName}> is not a valid element name. This project is configured to only allow names matching the following regular expression:`,
6020
6049
  "",
@@ -6531,7 +6560,7 @@ class EmptyTitle extends Rule {
6531
6560
  }
6532
6561
  }
6533
6562
 
6534
- const defaults$l = {
6563
+ const defaults$m = {
6535
6564
  allowArrayBrackets: true,
6536
6565
  allowCheckboxDefault: true,
6537
6566
  shared: ["radio", "button", "reset", "submit"]
@@ -6591,7 +6620,7 @@ function getDocumentation(context) {
6591
6620
  }
6592
6621
  class FormDupName extends Rule {
6593
6622
  constructor(options) {
6594
- super({ ...defaults$l, ...options });
6623
+ super({ ...defaults$m, ...options });
6595
6624
  }
6596
6625
  static schema() {
6597
6626
  return {
@@ -6750,7 +6779,7 @@ class FormDupName extends Rule {
6750
6779
  }
6751
6780
  }
6752
6781
 
6753
- const defaults$k = {
6782
+ const defaults$l = {
6754
6783
  allowMultipleH1: false,
6755
6784
  minInitialRank: "h1",
6756
6785
  sectioningRoots: ["dialog", '[role="dialog"]', '[role="alertdialog"]']
@@ -6782,7 +6811,7 @@ class HeadingLevel extends Rule {
6782
6811
  sectionRoots;
6783
6812
  stack = [];
6784
6813
  constructor(options) {
6785
- super({ ...defaults$k, ...options });
6814
+ super({ ...defaults$l, ...options });
6786
6815
  this.minInitialRank = parseMaxInitial(this.options.minInitialRank);
6787
6816
  this.sectionRoots = this.options.sectioningRoots.map((it) => new Compound(it));
6788
6817
  this.stack.push({
@@ -7021,7 +7050,7 @@ class HiddenFocusable extends Rule {
7021
7050
  }
7022
7051
  }
7023
7052
 
7024
- const defaults$j = {
7053
+ const defaults$k = {
7025
7054
  pattern: "kebabcase"
7026
7055
  };
7027
7056
  function exclude$1(set, ...values) {
@@ -7037,7 +7066,7 @@ class IdPattern extends BasePatternRule {
7037
7066
  super({
7038
7067
  ruleId: "id-pattern",
7039
7068
  attr: "id",
7040
- options: { ...defaults$j, ...options },
7069
+ options: { ...defaults$k, ...options },
7041
7070
  allowedPatterns
7042
7071
  });
7043
7072
  }
@@ -7359,13 +7388,13 @@ function findLabelByParent(el) {
7359
7388
  return [];
7360
7389
  }
7361
7390
 
7362
- const defaults$i = {
7391
+ const defaults$j = {
7363
7392
  maxlength: 70
7364
7393
  };
7365
7394
  class LongTitle extends Rule {
7366
7395
  maxlength;
7367
7396
  constructor(options) {
7368
- super({ ...defaults$i, ...options });
7397
+ super({ ...defaults$j, ...options });
7369
7398
  this.maxlength = this.options.maxlength;
7370
7399
  }
7371
7400
  static schema() {
@@ -7469,12 +7498,12 @@ class MapIdName extends Rule {
7469
7498
  }
7470
7499
  }
7471
7500
 
7472
- const defaults$h = {
7501
+ const defaults$i = {
7473
7502
  allowLongDelay: false
7474
7503
  };
7475
7504
  class MetaRefresh extends Rule {
7476
7505
  constructor(options) {
7477
- super({ ...defaults$h, ...options });
7506
+ super({ ...defaults$i, ...options });
7478
7507
  }
7479
7508
  documentation() {
7480
7509
  return {
@@ -7585,7 +7614,7 @@ class MultipleLabeledControls extends Rule {
7585
7614
  }
7586
7615
  }
7587
7616
 
7588
- const defaults$g = {
7617
+ const defaults$h = {
7589
7618
  pattern: "camelcase"
7590
7619
  };
7591
7620
  function exclude(set, ...values) {
@@ -7601,7 +7630,7 @@ class NamePattern extends BasePatternRule {
7601
7630
  super({
7602
7631
  ruleId: "name-pattern",
7603
7632
  attr: "name",
7604
- options: { ...defaults$g, ...options },
7633
+ options: { ...defaults$h, ...options },
7605
7634
  allowedPatterns
7606
7635
  });
7607
7636
  }
@@ -7692,13 +7721,13 @@ class NoAbstractRole extends Rule {
7692
7721
  }
7693
7722
  }
7694
7723
 
7695
- const defaults$f = {
7724
+ const defaults$g = {
7696
7725
  include: null,
7697
7726
  exclude: null
7698
7727
  };
7699
7728
  class NoAutoplay extends Rule {
7700
7729
  constructor(options) {
7701
- super({ ...defaults$f, ...options });
7730
+ super({ ...defaults$g, ...options });
7702
7731
  }
7703
7732
  documentation(context) {
7704
7733
  return {
@@ -8020,14 +8049,14 @@ class NoImplicitInputType extends Rule {
8020
8049
  }
8021
8050
  }
8022
8051
 
8023
- const defaults$e = {
8052
+ const defaults$f = {
8024
8053
  include: null,
8025
8054
  exclude: null,
8026
8055
  allowedProperties: ["display"]
8027
8056
  };
8028
8057
  class NoInlineStyle extends Rule {
8029
8058
  constructor(options) {
8030
- super({ ...defaults$e, ...options });
8059
+ super({ ...defaults$f, ...options });
8031
8060
  }
8032
8061
  static schema() {
8033
8062
  return {
@@ -8213,7 +8242,7 @@ class NoMultipleMain extends Rule {
8213
8242
  }
8214
8243
  }
8215
8244
 
8216
- const defaults$d = {
8245
+ const defaults$e = {
8217
8246
  relaxed: false
8218
8247
  };
8219
8248
  const textRegexp = /([<>]|&(?![a-zA-Z0-9#]+;))/g;
@@ -8231,7 +8260,7 @@ const replacementTable = {
8231
8260
  class NoRawCharacters extends Rule {
8232
8261
  relaxed;
8233
8262
  constructor(options) {
8234
- super({ ...defaults$d, ...options });
8263
+ super({ ...defaults$e, ...options });
8235
8264
  this.relaxed = this.options.relaxed;
8236
8265
  }
8237
8266
  static schema() {
@@ -8411,13 +8440,13 @@ class NoRedundantRole extends Rule {
8411
8440
  }
8412
8441
 
8413
8442
  const xmlns = /^(.+):.+$/;
8414
- const defaults$c = {
8443
+ const defaults$d = {
8415
8444
  ignoreForeign: true,
8416
8445
  ignoreXML: true
8417
8446
  };
8418
8447
  class NoSelfClosing extends Rule {
8419
8448
  constructor(options) {
8420
- super({ ...defaults$c, ...options });
8449
+ super({ ...defaults$d, ...options });
8421
8450
  }
8422
8451
  static schema() {
8423
8452
  return {
@@ -8467,7 +8496,20 @@ function isRelevant(node, options) {
8467
8496
  return true;
8468
8497
  }
8469
8498
 
8499
+ const defaults$c = {
8500
+ allowTemplate: true
8501
+ };
8470
8502
  class NoStyleTag extends Rule {
8503
+ constructor(options) {
8504
+ super({ ...defaults$c, ...options });
8505
+ }
8506
+ static schema() {
8507
+ return {
8508
+ allowTemplate: {
8509
+ type: "boolean"
8510
+ }
8511
+ };
8512
+ }
8471
8513
  documentation() {
8472
8514
  return {
8473
8515
  description: "Prefer to use external stylesheets with the `<link>` tag instead of inlining the styling.",
@@ -8475,9 +8517,13 @@ class NoStyleTag extends Rule {
8475
8517
  };
8476
8518
  }
8477
8519
  setup() {
8520
+ const { allowTemplate } = this.options;
8478
8521
  this.on("tag:start", (event) => {
8479
8522
  const node = event.target;
8480
8523
  if (node.tagName === "style") {
8524
+ if (allowTemplate && node.parent?.is("template")) {
8525
+ return;
8526
+ }
8481
8527
  this.report(node, "Use external stylesheet with <link> instead of <style> tag");
8482
8528
  }
8483
8529
  });
@@ -9384,7 +9430,7 @@ function getTextFromReference(document, id) {
9384
9430
  if (!id || id instanceof DynamicValue) {
9385
9431
  return id;
9386
9432
  }
9387
- const selector = `#${id}`;
9433
+ const selector = generateIdSelector(id);
9388
9434
  const ref = document.querySelector(selector);
9389
9435
  if (ref) {
9390
9436
  return ref.textContent;
@@ -12123,7 +12169,7 @@ class EventHandler {
12123
12169
  }
12124
12170
 
12125
12171
  const name = "html-validate";
12126
- const version = "10.6.0";
12172
+ const version = "10.7.0";
12127
12173
  const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
12128
12174
 
12129
12175
  function freeze(src) {
@@ -12669,31 +12715,34 @@ class Parser {
12669
12715
  * @internal
12670
12716
  */
12671
12717
  consumeDirective(token) {
12672
- const [text, preamble, action, separator1, directive, postamble] = token.data;
12673
- if (!postamble.startsWith("]")) {
12674
- throw new ParserError(token.location, `Missing end bracket "]" on directive "${text}"`);
12718
+ const [text, preamble, prefix, action, separator1, directive, postamble] = token.data;
12719
+ const hasStartBracket = preamble.includes("[");
12720
+ const hasEndBracket = postamble.startsWith("]");
12721
+ if (hasStartBracket && !hasEndBracket) {
12722
+ this.trigger("parse:error", {
12723
+ location: sliceLocation(token.location, preamble.length - 1, -postamble.length),
12724
+ message: `Missing end bracket "]" on directive "${text}"`
12725
+ });
12726
+ return;
12675
12727
  }
12676
12728
  const match = /^(.*?)(?:(\s*(?:--|:)\s*)(.*))?$/.exec(directive);
12677
12729
  if (!match) {
12678
12730
  throw new Error(`Failed to parse directive "${text}"`);
12679
12731
  }
12680
12732
  if (!isValidDirective(action)) {
12733
+ const begin = preamble.length;
12734
+ const end = preamble.length + prefix.length + action.length;
12681
12735
  this.trigger("parse:error", {
12682
- location: token.location,
12736
+ location: sliceLocation(token.location, begin, -text.length + end),
12683
12737
  message: `Unknown directive "${action}"`
12684
12738
  });
12685
12739
  return;
12686
12740
  }
12687
12741
  const [, data, separator2, comment] = match;
12688
- const prefix = "html-validate-";
12689
- const actionOffset = preamble.length;
12742
+ const actionOffset = preamble.length + prefix.length;
12690
12743
  const optionsOffset = actionOffset + action.length + separator1.length;
12691
12744
  const commentOffset = optionsOffset + data.length + (separator2 || "").length;
12692
- const location = sliceLocation(
12693
- token.location,
12694
- preamble.length - prefix.length - 1,
12695
- -postamble.length + 1
12696
- );
12745
+ const location = sliceLocation(token.location, preamble.length - 1, -postamble.length + 1);
12697
12746
  const actionLocation = sliceLocation(
12698
12747
  token.location,
12699
12748
  actionOffset,
@@ -14540,5 +14589,5 @@ const engines = {
14540
14589
 
14541
14590
  var workerPath = "./jest-worker.js";
14542
14591
 
14543
- export { compatibilityCheckImpl as $, Attribute as A, Reporter as B, Config as C, DOMNode as D, definePlugin as E, ruleExists as F, walk as G, HtmlElement as H, EventHandler as I, engines as J, normalizeSource as K, transformSource as L, MetaCopyableProperty as M, NodeClosed as N, Engine as O, Parser as P, transformSourceSync as Q, ResolvedConfig as R, Severity as S, TextNode as T, UserError as U, Validator as V, WrappedError as W, transformFilename as X, transformFilenameSync as Y, configurationSchema as Z, isThenable as _, ConfigError as a, workerPath as a0, codeframe as a1, name as a2, bugs as a3, ConfigLoader as b, defineConfig as c, deepmerge as d, ensureError as e, StaticConfigLoader as f, getFormatter as g, DOMTokenList as h, ignore as i, DOMTree as j, DynamicValue as k, NodeType as l, NestedError as m, SchemaValidationError as n, isUserError as o, presets as p, MetaTable as q, TextContent$1 as r, staticResolver as s, Rule as t, TextClassification as u, version as v, ariaNaming as w, classifyNodeText as x, keywordPatternMatcher as y, sliceLocation as z };
14592
+ export { engines as $, Attribute as A, isUserError as B, ConfigLoader as C, DOMNode as D, Engine as E, MetaTable as F, TextContent$1 as G, HtmlElement as H, Rule as I, TextClassification as J, ariaNaming as K, classifyNodeText as L, MetaCopyableProperty as M, NodeClosed as N, keywordPatternMatcher as O, Parser as P, sliceLocation as Q, Reporter as R, StaticConfigLoader as S, TextNode as T, UserError as U, Validator as V, WrappedError as W, definePlugin as X, ruleExists as Y, walk as Z, EventHandler as _, transformSourceSync as a, workerPath as a0, codeframe as a1, name as a2, bugs as a3, transformFilename as b, transformFilenameSync as c, configurationSchema as d, ConfigError as e, Config as f, compatibilityCheckImpl as g, getFormatter as h, isThenable as i, ensureError as j, deepmerge as k, ignore as l, ResolvedConfig as m, normalizeSource as n, Severity as o, presets as p, defineConfig as q, DOMTokenList as r, staticResolver as s, transformSource as t, DOMTree as u, version as v, DynamicValue as w, NodeType as x, NestedError as y, SchemaValidationError as z };
14544
14593
  //# sourceMappingURL=core.js.map