html-validate 8.13.0 → 8.14.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
@@ -3854,7 +3854,7 @@ class Rule {
3854
3854
  }
3855
3855
  }
3856
3856
 
3857
- const defaults$v = {
3857
+ const defaults$w = {
3858
3858
  allowExternal: true,
3859
3859
  allowRelative: true,
3860
3860
  allowAbsolute: true,
@@ -3895,7 +3895,7 @@ function matchList(value, list) {
3895
3895
  }
3896
3896
  class AllowedLinks extends Rule {
3897
3897
  constructor(options) {
3898
- super({ ...defaults$v, ...options });
3898
+ super({ ...defaults$w, ...options });
3899
3899
  this.allowExternal = parseAllow(this.options.allowExternal);
3900
3900
  this.allowRelative = parseAllow(this.options.allowRelative);
3901
3901
  this.allowAbsolute = parseAllow(this.options.allowAbsolute);
@@ -4059,7 +4059,7 @@ class AllowedLinks extends Rule {
4059
4059
  }
4060
4060
  }
4061
4061
 
4062
- const defaults$u = {
4062
+ const defaults$v = {
4063
4063
  accessible: true
4064
4064
  };
4065
4065
  function findByTarget(target, siblings) {
@@ -4089,7 +4089,7 @@ function getDescription$1(context) {
4089
4089
  }
4090
4090
  class AreaAlt extends Rule {
4091
4091
  constructor(options) {
4092
- super({ ...defaults$u, ...options });
4092
+ super({ ...defaults$v, ...options });
4093
4093
  }
4094
4094
  static schema() {
4095
4095
  return {
@@ -4168,7 +4168,7 @@ class AriaHiddenBody extends Rule {
4168
4168
  }
4169
4169
  }
4170
4170
 
4171
- const defaults$t = {
4171
+ const defaults$u = {
4172
4172
  allowAnyNamable: false
4173
4173
  };
4174
4174
  const whitelisted = [
@@ -4210,7 +4210,7 @@ function isValidUsage(target, meta) {
4210
4210
  }
4211
4211
  class AriaLabelMisuse extends Rule {
4212
4212
  constructor(options) {
4213
- super({ ...defaults$t, ...options });
4213
+ super({ ...defaults$u, ...options });
4214
4214
  }
4215
4215
  documentation() {
4216
4216
  const valid = [
@@ -4320,13 +4320,13 @@ class CaseStyle {
4320
4320
  }
4321
4321
  }
4322
4322
 
4323
- const defaults$s = {
4323
+ const defaults$t = {
4324
4324
  style: "lowercase",
4325
4325
  ignoreForeign: true
4326
4326
  };
4327
4327
  class AttrCase extends Rule {
4328
4328
  constructor(options) {
4329
- super({ ...defaults$s, ...options });
4329
+ super({ ...defaults$t, ...options });
4330
4330
  this.style = new CaseStyle(this.options.style, "attr-case");
4331
4331
  }
4332
4332
  static schema() {
@@ -4682,7 +4682,7 @@ class AttrDelimiter extends Rule {
4682
4682
  }
4683
4683
 
4684
4684
  const DEFAULT_PATTERN = "[a-z0-9-:]+";
4685
- const defaults$r = {
4685
+ const defaults$s = {
4686
4686
  pattern: DEFAULT_PATTERN,
4687
4687
  ignoreForeign: true
4688
4688
  };
@@ -4714,7 +4714,7 @@ function generateDescription(name, pattern) {
4714
4714
  }
4715
4715
  class AttrPattern extends Rule {
4716
4716
  constructor(options) {
4717
- super({ ...defaults$r, ...options });
4717
+ super({ ...defaults$s, ...options });
4718
4718
  this.pattern = generateRegexp(this.options.pattern);
4719
4719
  }
4720
4720
  static schema() {
@@ -4761,7 +4761,7 @@ class AttrPattern extends Rule {
4761
4761
  }
4762
4762
  }
4763
4763
 
4764
- const defaults$q = {
4764
+ const defaults$r = {
4765
4765
  style: "auto",
4766
4766
  unquoted: false
4767
4767
  };
@@ -4800,7 +4800,7 @@ function describeStyle(style, unquoted) {
4800
4800
  }
4801
4801
  class AttrQuotes extends Rule {
4802
4802
  constructor(options) {
4803
- super({ ...defaults$q, ...options });
4803
+ super({ ...defaults$r, ...options });
4804
4804
  this.style = parseStyle$3(this.options.style);
4805
4805
  }
4806
4806
  static schema() {
@@ -4984,12 +4984,12 @@ class AttributeAllowedValues extends Rule {
4984
4984
  }
4985
4985
  }
4986
4986
 
4987
- const defaults$p = {
4987
+ const defaults$q = {
4988
4988
  style: "omit"
4989
4989
  };
4990
4990
  class AttributeBooleanStyle extends Rule {
4991
4991
  constructor(options) {
4992
- super({ ...defaults$p, ...options });
4992
+ super({ ...defaults$q, ...options });
4993
4993
  this.hasInvalidStyle = parseStyle$2(this.options.style);
4994
4994
  }
4995
4995
  static schema() {
@@ -5056,12 +5056,12 @@ function reportMessage$1(attr, style) {
5056
5056
  return "";
5057
5057
  }
5058
5058
 
5059
- const defaults$o = {
5059
+ const defaults$p = {
5060
5060
  style: "omit"
5061
5061
  };
5062
5062
  class AttributeEmptyStyle extends Rule {
5063
5063
  constructor(options) {
5064
- super({ ...defaults$o, ...options });
5064
+ super({ ...defaults$p, ...options });
5065
5065
  this.hasInvalidStyle = parseStyle$1(this.options.style);
5066
5066
  }
5067
5067
  static schema() {
@@ -5201,12 +5201,12 @@ function describePattern(pattern) {
5201
5201
  }
5202
5202
  }
5203
5203
 
5204
- const defaults$n = {
5204
+ const defaults$o = {
5205
5205
  pattern: "kebabcase"
5206
5206
  };
5207
5207
  class ClassPattern extends Rule {
5208
5208
  constructor(options) {
5209
- super({ ...defaults$n, ...options });
5209
+ super({ ...defaults$o, ...options });
5210
5210
  this.pattern = parsePattern(this.options.pattern);
5211
5211
  }
5212
5212
  static schema() {
@@ -5312,13 +5312,13 @@ class CloseOrder extends Rule {
5312
5312
  }
5313
5313
  }
5314
5314
 
5315
- const defaults$m = {
5315
+ const defaults$n = {
5316
5316
  include: null,
5317
5317
  exclude: null
5318
5318
  };
5319
5319
  class Deprecated extends Rule {
5320
5320
  constructor(options) {
5321
- super({ ...defaults$m, ...options });
5321
+ super({ ...defaults$n, ...options });
5322
5322
  }
5323
5323
  static schema() {
5324
5324
  return {
@@ -5472,12 +5472,12 @@ let NoStyleTag$1 = class NoStyleTag extends Rule {
5472
5472
  }
5473
5473
  };
5474
5474
 
5475
- const defaults$l = {
5475
+ const defaults$m = {
5476
5476
  style: "uppercase"
5477
5477
  };
5478
5478
  class DoctypeStyle extends Rule {
5479
5479
  constructor(options) {
5480
- super({ ...defaults$l, ...options });
5480
+ super({ ...defaults$m, ...options });
5481
5481
  }
5482
5482
  static schema() {
5483
5483
  return {
@@ -5505,12 +5505,12 @@ class DoctypeStyle extends Rule {
5505
5505
  }
5506
5506
  }
5507
5507
 
5508
- const defaults$k = {
5508
+ const defaults$l = {
5509
5509
  style: "lowercase"
5510
5510
  };
5511
5511
  class ElementCase extends Rule {
5512
5512
  constructor(options) {
5513
- super({ ...defaults$k, ...options });
5513
+ super({ ...defaults$l, ...options });
5514
5514
  this.style = new CaseStyle(this.options.style, "element-case");
5515
5515
  }
5516
5516
  static schema() {
@@ -5570,14 +5570,14 @@ class ElementCase extends Rule {
5570
5570
  }
5571
5571
  }
5572
5572
 
5573
- const defaults$j = {
5573
+ const defaults$k = {
5574
5574
  pattern: "^[a-z][a-z0-9\\-._]*-[a-z0-9\\-._]*$",
5575
5575
  whitelist: [],
5576
5576
  blacklist: []
5577
5577
  };
5578
5578
  class ElementName extends Rule {
5579
5579
  constructor(options) {
5580
- super({ ...defaults$j, ...options });
5580
+ super({ ...defaults$k, ...options });
5581
5581
  this.pattern = new RegExp(this.options.pattern);
5582
5582
  }
5583
5583
  static schema() {
@@ -5614,7 +5614,7 @@ class ElementName extends Rule {
5614
5614
  ...context.blacklist.map((cur) => `- ${cur}`)
5615
5615
  ];
5616
5616
  }
5617
- if (context.pattern !== defaults$j.pattern) {
5617
+ if (context.pattern !== defaults$k.pattern) {
5618
5618
  return [
5619
5619
  `<${context.tagName}> is not a valid element name. This project is configured to only allow names matching the following regular expression:`,
5620
5620
  "",
@@ -6103,7 +6103,7 @@ class EmptyTitle extends Rule {
6103
6103
  }
6104
6104
  }
6105
6105
 
6106
- const defaults$i = {
6106
+ const defaults$j = {
6107
6107
  allowArrayBrackets: true,
6108
6108
  shared: ["radio", "button", "reset", "submit"]
6109
6109
  };
@@ -6131,7 +6131,7 @@ function getDocumentation(context) {
6131
6131
  }
6132
6132
  class FormDupName extends Rule {
6133
6133
  constructor(options) {
6134
- super({ ...defaults$i, ...options });
6134
+ super({ ...defaults$j, ...options });
6135
6135
  }
6136
6136
  static schema() {
6137
6137
  return {
@@ -6280,7 +6280,7 @@ class FormDupName extends Rule {
6280
6280
  }
6281
6281
  }
6282
6282
 
6283
- const defaults$h = {
6283
+ const defaults$i = {
6284
6284
  allowMultipleH1: false,
6285
6285
  minInitialRank: "h1",
6286
6286
  sectioningRoots: ["dialog", '[role="dialog"]', '[role="alertdialog"]']
@@ -6309,7 +6309,7 @@ function parseMaxInitial(value) {
6309
6309
  }
6310
6310
  class HeadingLevel extends Rule {
6311
6311
  constructor(options) {
6312
- super({ ...defaults$h, ...options });
6312
+ super({ ...defaults$i, ...options });
6313
6313
  this.stack = [];
6314
6314
  this.minInitialRank = parseMaxInitial(this.options.minInitialRank);
6315
6315
  this.sectionRoots = this.options.sectioningRoots.map((it) => new Pattern(it));
@@ -6512,12 +6512,12 @@ class HiddenFocusable extends Rule {
6512
6512
  }
6513
6513
  }
6514
6514
 
6515
- const defaults$g = {
6515
+ const defaults$h = {
6516
6516
  pattern: "kebabcase"
6517
6517
  };
6518
6518
  class IdPattern extends Rule {
6519
6519
  constructor(options) {
6520
- super({ ...defaults$g, ...options });
6520
+ super({ ...defaults$h, ...options });
6521
6521
  this.pattern = parsePattern(this.options.pattern);
6522
6522
  }
6523
6523
  static schema() {
@@ -6870,12 +6870,12 @@ function findLabelByParent(el) {
6870
6870
  return [];
6871
6871
  }
6872
6872
 
6873
- const defaults$f = {
6873
+ const defaults$g = {
6874
6874
  maxlength: 70
6875
6875
  };
6876
6876
  class LongTitle extends Rule {
6877
6877
  constructor(options) {
6878
- super({ ...defaults$f, ...options });
6878
+ super({ ...defaults$g, ...options });
6879
6879
  this.maxlength = this.options.maxlength;
6880
6880
  }
6881
6881
  static schema() {
@@ -6904,7 +6904,13 @@ class LongTitle extends Rule {
6904
6904
  }
6905
6905
  }
6906
6906
 
6907
+ const defaults$f = {
6908
+ allowLongDelay: false
6909
+ };
6907
6910
  class MetaRefresh extends Rule {
6911
+ constructor(options) {
6912
+ super({ ...defaults$f, ...options });
6913
+ }
6908
6914
  documentation() {
6909
6915
  return {
6910
6916
  description: `Meta refresh directive must use the \`0;url=...\` format. Non-zero values for time interval is disallowed as people with assistive technology might be unable to read and understand the page content before automatically reloading. For the same reason skipping the url is disallowed as it would put the browser in an infinite loop reloading the same page over and over again.`,
@@ -6930,14 +6936,24 @@ class MetaRefresh extends Rule {
6930
6936
  this.report(target, "Malformed meta refresh directive", location);
6931
6937
  return;
6932
6938
  }
6933
- if (!value.url) {
6934
- this.report(target, "Don't use meta refresh to reload the page", location);
6935
- }
6936
- if (value.delay !== 0) {
6937
- this.report(target, "Meta refresh must use 0 second delay", location);
6938
- }
6939
+ const { delay, url } = value;
6940
+ this.validateDelay(target, location, delay, url);
6939
6941
  });
6940
6942
  }
6943
+ validateDelay(target, location, delay, url) {
6944
+ const { allowLongDelay } = this.options;
6945
+ if (allowLongDelay && delay > 72e3) {
6946
+ return;
6947
+ }
6948
+ if (!url && delay === 0) {
6949
+ this.report(target, "Don't use instant meta refresh to reload the page", location);
6950
+ return;
6951
+ }
6952
+ if (delay !== 0) {
6953
+ const message = allowLongDelay ? "Meta refresh must be instant (0 second delay) or greater than 20 hours (72000 second delay)" : "Meta refresh must be instant (0 second delay)";
6954
+ this.report(target, message, location);
6955
+ }
6956
+ }
6941
6957
  }
6942
6958
  function parseContent(text) {
6943
6959
  const match = text.match(/^(\d+)(?:\s*;\s*url=(.*))?/);
@@ -11982,7 +11998,7 @@ class HtmlValidate {
11982
11998
  }
11983
11999
 
11984
12000
  const name = "html-validate";
11985
- const version = "8.13.0";
12001
+ const version = "8.14.0";
11986
12002
  const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
11987
12003
 
11988
12004
  function definePlugin(plugin) {