html-validate 8.12.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 +67 -43
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/elements.js +230 -2
- package/dist/cjs/elements.js.map +1 -1
- package/dist/cjs/tsdoc-metadata.json +1 -1
- package/dist/es/core.js +67 -43
- package/dist/es/core.js.map +1 -1
- package/dist/es/elements.js +230 -2
- package/dist/es/elements.js.map +1 -1
- package/dist/schema/elements.json +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types/browser.d.ts +19 -7
- package/dist/types/index.d.ts +19 -7
- package/package.json +7 -7
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
|
|
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
|
}
|
|
@@ -3836,7 +3844,7 @@ class Rule {
|
|
|
3836
3844
|
}
|
|
3837
3845
|
}
|
|
3838
3846
|
|
|
3839
|
-
const defaults$
|
|
3847
|
+
const defaults$w = {
|
|
3840
3848
|
allowExternal: true,
|
|
3841
3849
|
allowRelative: true,
|
|
3842
3850
|
allowAbsolute: true,
|
|
@@ -3877,7 +3885,7 @@ function matchList(value, list) {
|
|
|
3877
3885
|
}
|
|
3878
3886
|
class AllowedLinks extends Rule {
|
|
3879
3887
|
constructor(options) {
|
|
3880
|
-
super({ ...defaults$
|
|
3888
|
+
super({ ...defaults$w, ...options });
|
|
3881
3889
|
this.allowExternal = parseAllow(this.options.allowExternal);
|
|
3882
3890
|
this.allowRelative = parseAllow(this.options.allowRelative);
|
|
3883
3891
|
this.allowAbsolute = parseAllow(this.options.allowAbsolute);
|
|
@@ -4041,7 +4049,7 @@ class AllowedLinks extends Rule {
|
|
|
4041
4049
|
}
|
|
4042
4050
|
}
|
|
4043
4051
|
|
|
4044
|
-
const defaults$
|
|
4052
|
+
const defaults$v = {
|
|
4045
4053
|
accessible: true
|
|
4046
4054
|
};
|
|
4047
4055
|
function findByTarget(target, siblings) {
|
|
@@ -4071,7 +4079,7 @@ function getDescription$1(context) {
|
|
|
4071
4079
|
}
|
|
4072
4080
|
class AreaAlt extends Rule {
|
|
4073
4081
|
constructor(options) {
|
|
4074
|
-
super({ ...defaults$
|
|
4082
|
+
super({ ...defaults$v, ...options });
|
|
4075
4083
|
}
|
|
4076
4084
|
static schema() {
|
|
4077
4085
|
return {
|
|
@@ -4150,7 +4158,7 @@ class AriaHiddenBody extends Rule {
|
|
|
4150
4158
|
}
|
|
4151
4159
|
}
|
|
4152
4160
|
|
|
4153
|
-
const defaults$
|
|
4161
|
+
const defaults$u = {
|
|
4154
4162
|
allowAnyNamable: false
|
|
4155
4163
|
};
|
|
4156
4164
|
const whitelisted = [
|
|
@@ -4192,7 +4200,7 @@ function isValidUsage(target, meta) {
|
|
|
4192
4200
|
}
|
|
4193
4201
|
class AriaLabelMisuse extends Rule {
|
|
4194
4202
|
constructor(options) {
|
|
4195
|
-
super({ ...defaults$
|
|
4203
|
+
super({ ...defaults$u, ...options });
|
|
4196
4204
|
}
|
|
4197
4205
|
documentation() {
|
|
4198
4206
|
const valid = [
|
|
@@ -4302,13 +4310,13 @@ class CaseStyle {
|
|
|
4302
4310
|
}
|
|
4303
4311
|
}
|
|
4304
4312
|
|
|
4305
|
-
const defaults$
|
|
4313
|
+
const defaults$t = {
|
|
4306
4314
|
style: "lowercase",
|
|
4307
4315
|
ignoreForeign: true
|
|
4308
4316
|
};
|
|
4309
4317
|
class AttrCase extends Rule {
|
|
4310
4318
|
constructor(options) {
|
|
4311
|
-
super({ ...defaults$
|
|
4319
|
+
super({ ...defaults$t, ...options });
|
|
4312
4320
|
this.style = new CaseStyle(this.options.style, "attr-case");
|
|
4313
4321
|
}
|
|
4314
4322
|
static schema() {
|
|
@@ -4664,7 +4672,7 @@ class AttrDelimiter extends Rule {
|
|
|
4664
4672
|
}
|
|
4665
4673
|
|
|
4666
4674
|
const DEFAULT_PATTERN = "[a-z0-9-:]+";
|
|
4667
|
-
const defaults$
|
|
4675
|
+
const defaults$s = {
|
|
4668
4676
|
pattern: DEFAULT_PATTERN,
|
|
4669
4677
|
ignoreForeign: true
|
|
4670
4678
|
};
|
|
@@ -4696,7 +4704,7 @@ function generateDescription(name, pattern) {
|
|
|
4696
4704
|
}
|
|
4697
4705
|
class AttrPattern extends Rule {
|
|
4698
4706
|
constructor(options) {
|
|
4699
|
-
super({ ...defaults$
|
|
4707
|
+
super({ ...defaults$s, ...options });
|
|
4700
4708
|
this.pattern = generateRegexp(this.options.pattern);
|
|
4701
4709
|
}
|
|
4702
4710
|
static schema() {
|
|
@@ -4743,7 +4751,7 @@ class AttrPattern extends Rule {
|
|
|
4743
4751
|
}
|
|
4744
4752
|
}
|
|
4745
4753
|
|
|
4746
|
-
const defaults$
|
|
4754
|
+
const defaults$r = {
|
|
4747
4755
|
style: "auto",
|
|
4748
4756
|
unquoted: false
|
|
4749
4757
|
};
|
|
@@ -4782,7 +4790,7 @@ function describeStyle(style, unquoted) {
|
|
|
4782
4790
|
}
|
|
4783
4791
|
class AttrQuotes extends Rule {
|
|
4784
4792
|
constructor(options) {
|
|
4785
|
-
super({ ...defaults$
|
|
4793
|
+
super({ ...defaults$r, ...options });
|
|
4786
4794
|
this.style = parseStyle$3(this.options.style);
|
|
4787
4795
|
}
|
|
4788
4796
|
static schema() {
|
|
@@ -4966,12 +4974,12 @@ class AttributeAllowedValues extends Rule {
|
|
|
4966
4974
|
}
|
|
4967
4975
|
}
|
|
4968
4976
|
|
|
4969
|
-
const defaults$
|
|
4977
|
+
const defaults$q = {
|
|
4970
4978
|
style: "omit"
|
|
4971
4979
|
};
|
|
4972
4980
|
class AttributeBooleanStyle extends Rule {
|
|
4973
4981
|
constructor(options) {
|
|
4974
|
-
super({ ...defaults$
|
|
4982
|
+
super({ ...defaults$q, ...options });
|
|
4975
4983
|
this.hasInvalidStyle = parseStyle$2(this.options.style);
|
|
4976
4984
|
}
|
|
4977
4985
|
static schema() {
|
|
@@ -5038,12 +5046,12 @@ function reportMessage$1(attr, style) {
|
|
|
5038
5046
|
return "";
|
|
5039
5047
|
}
|
|
5040
5048
|
|
|
5041
|
-
const defaults$
|
|
5049
|
+
const defaults$p = {
|
|
5042
5050
|
style: "omit"
|
|
5043
5051
|
};
|
|
5044
5052
|
class AttributeEmptyStyle extends Rule {
|
|
5045
5053
|
constructor(options) {
|
|
5046
|
-
super({ ...defaults$
|
|
5054
|
+
super({ ...defaults$p, ...options });
|
|
5047
5055
|
this.hasInvalidStyle = parseStyle$1(this.options.style);
|
|
5048
5056
|
}
|
|
5049
5057
|
static schema() {
|
|
@@ -5183,12 +5191,12 @@ function describePattern(pattern) {
|
|
|
5183
5191
|
}
|
|
5184
5192
|
}
|
|
5185
5193
|
|
|
5186
|
-
const defaults$
|
|
5194
|
+
const defaults$o = {
|
|
5187
5195
|
pattern: "kebabcase"
|
|
5188
5196
|
};
|
|
5189
5197
|
class ClassPattern extends Rule {
|
|
5190
5198
|
constructor(options) {
|
|
5191
|
-
super({ ...defaults$
|
|
5199
|
+
super({ ...defaults$o, ...options });
|
|
5192
5200
|
this.pattern = parsePattern(this.options.pattern);
|
|
5193
5201
|
}
|
|
5194
5202
|
static schema() {
|
|
@@ -5294,13 +5302,13 @@ class CloseOrder extends Rule {
|
|
|
5294
5302
|
}
|
|
5295
5303
|
}
|
|
5296
5304
|
|
|
5297
|
-
const defaults$
|
|
5305
|
+
const defaults$n = {
|
|
5298
5306
|
include: null,
|
|
5299
5307
|
exclude: null
|
|
5300
5308
|
};
|
|
5301
5309
|
class Deprecated extends Rule {
|
|
5302
5310
|
constructor(options) {
|
|
5303
|
-
super({ ...defaults$
|
|
5311
|
+
super({ ...defaults$n, ...options });
|
|
5304
5312
|
}
|
|
5305
5313
|
static schema() {
|
|
5306
5314
|
return {
|
|
@@ -5454,12 +5462,12 @@ let NoStyleTag$1 = class NoStyleTag extends Rule {
|
|
|
5454
5462
|
}
|
|
5455
5463
|
};
|
|
5456
5464
|
|
|
5457
|
-
const defaults$
|
|
5465
|
+
const defaults$m = {
|
|
5458
5466
|
style: "uppercase"
|
|
5459
5467
|
};
|
|
5460
5468
|
class DoctypeStyle extends Rule {
|
|
5461
5469
|
constructor(options) {
|
|
5462
|
-
super({ ...defaults$
|
|
5470
|
+
super({ ...defaults$m, ...options });
|
|
5463
5471
|
}
|
|
5464
5472
|
static schema() {
|
|
5465
5473
|
return {
|
|
@@ -5487,12 +5495,12 @@ class DoctypeStyle extends Rule {
|
|
|
5487
5495
|
}
|
|
5488
5496
|
}
|
|
5489
5497
|
|
|
5490
|
-
const defaults$
|
|
5498
|
+
const defaults$l = {
|
|
5491
5499
|
style: "lowercase"
|
|
5492
5500
|
};
|
|
5493
5501
|
class ElementCase extends Rule {
|
|
5494
5502
|
constructor(options) {
|
|
5495
|
-
super({ ...defaults$
|
|
5503
|
+
super({ ...defaults$l, ...options });
|
|
5496
5504
|
this.style = new CaseStyle(this.options.style, "element-case");
|
|
5497
5505
|
}
|
|
5498
5506
|
static schema() {
|
|
@@ -5552,14 +5560,14 @@ class ElementCase extends Rule {
|
|
|
5552
5560
|
}
|
|
5553
5561
|
}
|
|
5554
5562
|
|
|
5555
|
-
const defaults$
|
|
5563
|
+
const defaults$k = {
|
|
5556
5564
|
pattern: "^[a-z][a-z0-9\\-._]*-[a-z0-9\\-._]*$",
|
|
5557
5565
|
whitelist: [],
|
|
5558
5566
|
blacklist: []
|
|
5559
5567
|
};
|
|
5560
5568
|
class ElementName extends Rule {
|
|
5561
5569
|
constructor(options) {
|
|
5562
|
-
super({ ...defaults$
|
|
5570
|
+
super({ ...defaults$k, ...options });
|
|
5563
5571
|
this.pattern = new RegExp(this.options.pattern);
|
|
5564
5572
|
}
|
|
5565
5573
|
static schema() {
|
|
@@ -5596,7 +5604,7 @@ class ElementName extends Rule {
|
|
|
5596
5604
|
...context.blacklist.map((cur) => `- ${cur}`)
|
|
5597
5605
|
];
|
|
5598
5606
|
}
|
|
5599
|
-
if (context.pattern !== defaults$
|
|
5607
|
+
if (context.pattern !== defaults$k.pattern) {
|
|
5600
5608
|
return [
|
|
5601
5609
|
`<${context.tagName}> is not a valid element name. This project is configured to only allow names matching the following regular expression:`,
|
|
5602
5610
|
"",
|
|
@@ -6085,7 +6093,7 @@ class EmptyTitle extends Rule {
|
|
|
6085
6093
|
}
|
|
6086
6094
|
}
|
|
6087
6095
|
|
|
6088
|
-
const defaults$
|
|
6096
|
+
const defaults$j = {
|
|
6089
6097
|
allowArrayBrackets: true,
|
|
6090
6098
|
shared: ["radio", "button", "reset", "submit"]
|
|
6091
6099
|
};
|
|
@@ -6113,7 +6121,7 @@ function getDocumentation(context) {
|
|
|
6113
6121
|
}
|
|
6114
6122
|
class FormDupName extends Rule {
|
|
6115
6123
|
constructor(options) {
|
|
6116
|
-
super({ ...defaults$
|
|
6124
|
+
super({ ...defaults$j, ...options });
|
|
6117
6125
|
}
|
|
6118
6126
|
static schema() {
|
|
6119
6127
|
return {
|
|
@@ -6262,7 +6270,7 @@ class FormDupName extends Rule {
|
|
|
6262
6270
|
}
|
|
6263
6271
|
}
|
|
6264
6272
|
|
|
6265
|
-
const defaults$
|
|
6273
|
+
const defaults$i = {
|
|
6266
6274
|
allowMultipleH1: false,
|
|
6267
6275
|
minInitialRank: "h1",
|
|
6268
6276
|
sectioningRoots: ["dialog", '[role="dialog"]', '[role="alertdialog"]']
|
|
@@ -6291,7 +6299,7 @@ function parseMaxInitial(value) {
|
|
|
6291
6299
|
}
|
|
6292
6300
|
class HeadingLevel extends Rule {
|
|
6293
6301
|
constructor(options) {
|
|
6294
|
-
super({ ...defaults$
|
|
6302
|
+
super({ ...defaults$i, ...options });
|
|
6295
6303
|
this.stack = [];
|
|
6296
6304
|
this.minInitialRank = parseMaxInitial(this.options.minInitialRank);
|
|
6297
6305
|
this.sectionRoots = this.options.sectioningRoots.map((it) => new Pattern(it));
|
|
@@ -6494,12 +6502,12 @@ class HiddenFocusable extends Rule {
|
|
|
6494
6502
|
}
|
|
6495
6503
|
}
|
|
6496
6504
|
|
|
6497
|
-
const defaults$
|
|
6505
|
+
const defaults$h = {
|
|
6498
6506
|
pattern: "kebabcase"
|
|
6499
6507
|
};
|
|
6500
6508
|
class IdPattern extends Rule {
|
|
6501
6509
|
constructor(options) {
|
|
6502
|
-
super({ ...defaults$
|
|
6510
|
+
super({ ...defaults$h, ...options });
|
|
6503
6511
|
this.pattern = parsePattern(this.options.pattern);
|
|
6504
6512
|
}
|
|
6505
6513
|
static schema() {
|
|
@@ -6852,12 +6860,12 @@ function findLabelByParent(el) {
|
|
|
6852
6860
|
return [];
|
|
6853
6861
|
}
|
|
6854
6862
|
|
|
6855
|
-
const defaults$
|
|
6863
|
+
const defaults$g = {
|
|
6856
6864
|
maxlength: 70
|
|
6857
6865
|
};
|
|
6858
6866
|
class LongTitle extends Rule {
|
|
6859
6867
|
constructor(options) {
|
|
6860
|
-
super({ ...defaults$
|
|
6868
|
+
super({ ...defaults$g, ...options });
|
|
6861
6869
|
this.maxlength = this.options.maxlength;
|
|
6862
6870
|
}
|
|
6863
6871
|
static schema() {
|
|
@@ -6886,7 +6894,13 @@ class LongTitle extends Rule {
|
|
|
6886
6894
|
}
|
|
6887
6895
|
}
|
|
6888
6896
|
|
|
6897
|
+
const defaults$f = {
|
|
6898
|
+
allowLongDelay: false
|
|
6899
|
+
};
|
|
6889
6900
|
class MetaRefresh extends Rule {
|
|
6901
|
+
constructor(options) {
|
|
6902
|
+
super({ ...defaults$f, ...options });
|
|
6903
|
+
}
|
|
6890
6904
|
documentation() {
|
|
6891
6905
|
return {
|
|
6892
6906
|
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.`,
|
|
@@ -6912,14 +6926,24 @@ class MetaRefresh extends Rule {
|
|
|
6912
6926
|
this.report(target, "Malformed meta refresh directive", location);
|
|
6913
6927
|
return;
|
|
6914
6928
|
}
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
}
|
|
6918
|
-
if (value.delay !== 0) {
|
|
6919
|
-
this.report(target, "Meta refresh must use 0 second delay", location);
|
|
6920
|
-
}
|
|
6929
|
+
const { delay, url } = value;
|
|
6930
|
+
this.validateDelay(target, location, delay, url);
|
|
6921
6931
|
});
|
|
6922
6932
|
}
|
|
6933
|
+
validateDelay(target, location, delay, url) {
|
|
6934
|
+
const { allowLongDelay } = this.options;
|
|
6935
|
+
if (allowLongDelay && delay > 72e3) {
|
|
6936
|
+
return;
|
|
6937
|
+
}
|
|
6938
|
+
if (!url && delay === 0) {
|
|
6939
|
+
this.report(target, "Don't use instant meta refresh to reload the page", location);
|
|
6940
|
+
return;
|
|
6941
|
+
}
|
|
6942
|
+
if (delay !== 0) {
|
|
6943
|
+
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)";
|
|
6944
|
+
this.report(target, message, location);
|
|
6945
|
+
}
|
|
6946
|
+
}
|
|
6923
6947
|
}
|
|
6924
6948
|
function parseContent(text) {
|
|
6925
6949
|
const match = text.match(/^(\d+)(?:\s*;\s*url=(.*))?/);
|
|
@@ -11964,7 +11988,7 @@ class HtmlValidate {
|
|
|
11964
11988
|
}
|
|
11965
11989
|
|
|
11966
11990
|
const name = "html-validate";
|
|
11967
|
-
const version = "8.
|
|
11991
|
+
const version = "8.14.0";
|
|
11968
11992
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
11969
11993
|
|
|
11970
11994
|
function definePlugin(plugin) {
|