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/cjs/core.js
CHANGED
|
@@ -737,6 +737,9 @@ const definitions = {
|
|
|
737
737
|
},
|
|
738
738
|
{
|
|
739
739
|
$ref: "#/definitions/expression"
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
"function": true
|
|
740
743
|
}
|
|
741
744
|
]
|
|
742
745
|
},
|
|
@@ -1375,7 +1378,12 @@ class MetaTable {
|
|
|
1375
1378
|
function expandProperties(node, entry) {
|
|
1376
1379
|
for (const key of dynamicKeys) {
|
|
1377
1380
|
const property = entry[key];
|
|
1378
|
-
if (property
|
|
1381
|
+
if (!property) {
|
|
1382
|
+
continue;
|
|
1383
|
+
}
|
|
1384
|
+
if (typeof property === "function") {
|
|
1385
|
+
setMetaProperty(entry, key, property(node._adapter));
|
|
1386
|
+
} else if (typeof property !== "boolean") {
|
|
1379
1387
|
setMetaProperty(entry, key, evaluateProperty(node, property));
|
|
1380
1388
|
}
|
|
1381
1389
|
}
|
|
@@ -3846,7 +3854,7 @@ class Rule {
|
|
|
3846
3854
|
}
|
|
3847
3855
|
}
|
|
3848
3856
|
|
|
3849
|
-
const defaults$
|
|
3857
|
+
const defaults$w = {
|
|
3850
3858
|
allowExternal: true,
|
|
3851
3859
|
allowRelative: true,
|
|
3852
3860
|
allowAbsolute: true,
|
|
@@ -3887,7 +3895,7 @@ function matchList(value, list) {
|
|
|
3887
3895
|
}
|
|
3888
3896
|
class AllowedLinks extends Rule {
|
|
3889
3897
|
constructor(options) {
|
|
3890
|
-
super({ ...defaults$
|
|
3898
|
+
super({ ...defaults$w, ...options });
|
|
3891
3899
|
this.allowExternal = parseAllow(this.options.allowExternal);
|
|
3892
3900
|
this.allowRelative = parseAllow(this.options.allowRelative);
|
|
3893
3901
|
this.allowAbsolute = parseAllow(this.options.allowAbsolute);
|
|
@@ -4051,7 +4059,7 @@ class AllowedLinks extends Rule {
|
|
|
4051
4059
|
}
|
|
4052
4060
|
}
|
|
4053
4061
|
|
|
4054
|
-
const defaults$
|
|
4062
|
+
const defaults$v = {
|
|
4055
4063
|
accessible: true
|
|
4056
4064
|
};
|
|
4057
4065
|
function findByTarget(target, siblings) {
|
|
@@ -4081,7 +4089,7 @@ function getDescription$1(context) {
|
|
|
4081
4089
|
}
|
|
4082
4090
|
class AreaAlt extends Rule {
|
|
4083
4091
|
constructor(options) {
|
|
4084
|
-
super({ ...defaults$
|
|
4092
|
+
super({ ...defaults$v, ...options });
|
|
4085
4093
|
}
|
|
4086
4094
|
static schema() {
|
|
4087
4095
|
return {
|
|
@@ -4160,7 +4168,7 @@ class AriaHiddenBody extends Rule {
|
|
|
4160
4168
|
}
|
|
4161
4169
|
}
|
|
4162
4170
|
|
|
4163
|
-
const defaults$
|
|
4171
|
+
const defaults$u = {
|
|
4164
4172
|
allowAnyNamable: false
|
|
4165
4173
|
};
|
|
4166
4174
|
const whitelisted = [
|
|
@@ -4202,7 +4210,7 @@ function isValidUsage(target, meta) {
|
|
|
4202
4210
|
}
|
|
4203
4211
|
class AriaLabelMisuse extends Rule {
|
|
4204
4212
|
constructor(options) {
|
|
4205
|
-
super({ ...defaults$
|
|
4213
|
+
super({ ...defaults$u, ...options });
|
|
4206
4214
|
}
|
|
4207
4215
|
documentation() {
|
|
4208
4216
|
const valid = [
|
|
@@ -4312,13 +4320,13 @@ class CaseStyle {
|
|
|
4312
4320
|
}
|
|
4313
4321
|
}
|
|
4314
4322
|
|
|
4315
|
-
const defaults$
|
|
4323
|
+
const defaults$t = {
|
|
4316
4324
|
style: "lowercase",
|
|
4317
4325
|
ignoreForeign: true
|
|
4318
4326
|
};
|
|
4319
4327
|
class AttrCase extends Rule {
|
|
4320
4328
|
constructor(options) {
|
|
4321
|
-
super({ ...defaults$
|
|
4329
|
+
super({ ...defaults$t, ...options });
|
|
4322
4330
|
this.style = new CaseStyle(this.options.style, "attr-case");
|
|
4323
4331
|
}
|
|
4324
4332
|
static schema() {
|
|
@@ -4674,7 +4682,7 @@ class AttrDelimiter extends Rule {
|
|
|
4674
4682
|
}
|
|
4675
4683
|
|
|
4676
4684
|
const DEFAULT_PATTERN = "[a-z0-9-:]+";
|
|
4677
|
-
const defaults$
|
|
4685
|
+
const defaults$s = {
|
|
4678
4686
|
pattern: DEFAULT_PATTERN,
|
|
4679
4687
|
ignoreForeign: true
|
|
4680
4688
|
};
|
|
@@ -4706,7 +4714,7 @@ function generateDescription(name, pattern) {
|
|
|
4706
4714
|
}
|
|
4707
4715
|
class AttrPattern extends Rule {
|
|
4708
4716
|
constructor(options) {
|
|
4709
|
-
super({ ...defaults$
|
|
4717
|
+
super({ ...defaults$s, ...options });
|
|
4710
4718
|
this.pattern = generateRegexp(this.options.pattern);
|
|
4711
4719
|
}
|
|
4712
4720
|
static schema() {
|
|
@@ -4753,7 +4761,7 @@ class AttrPattern extends Rule {
|
|
|
4753
4761
|
}
|
|
4754
4762
|
}
|
|
4755
4763
|
|
|
4756
|
-
const defaults$
|
|
4764
|
+
const defaults$r = {
|
|
4757
4765
|
style: "auto",
|
|
4758
4766
|
unquoted: false
|
|
4759
4767
|
};
|
|
@@ -4792,7 +4800,7 @@ function describeStyle(style, unquoted) {
|
|
|
4792
4800
|
}
|
|
4793
4801
|
class AttrQuotes extends Rule {
|
|
4794
4802
|
constructor(options) {
|
|
4795
|
-
super({ ...defaults$
|
|
4803
|
+
super({ ...defaults$r, ...options });
|
|
4796
4804
|
this.style = parseStyle$3(this.options.style);
|
|
4797
4805
|
}
|
|
4798
4806
|
static schema() {
|
|
@@ -4976,12 +4984,12 @@ class AttributeAllowedValues extends Rule {
|
|
|
4976
4984
|
}
|
|
4977
4985
|
}
|
|
4978
4986
|
|
|
4979
|
-
const defaults$
|
|
4987
|
+
const defaults$q = {
|
|
4980
4988
|
style: "omit"
|
|
4981
4989
|
};
|
|
4982
4990
|
class AttributeBooleanStyle extends Rule {
|
|
4983
4991
|
constructor(options) {
|
|
4984
|
-
super({ ...defaults$
|
|
4992
|
+
super({ ...defaults$q, ...options });
|
|
4985
4993
|
this.hasInvalidStyle = parseStyle$2(this.options.style);
|
|
4986
4994
|
}
|
|
4987
4995
|
static schema() {
|
|
@@ -5048,12 +5056,12 @@ function reportMessage$1(attr, style) {
|
|
|
5048
5056
|
return "";
|
|
5049
5057
|
}
|
|
5050
5058
|
|
|
5051
|
-
const defaults$
|
|
5059
|
+
const defaults$p = {
|
|
5052
5060
|
style: "omit"
|
|
5053
5061
|
};
|
|
5054
5062
|
class AttributeEmptyStyle extends Rule {
|
|
5055
5063
|
constructor(options) {
|
|
5056
|
-
super({ ...defaults$
|
|
5064
|
+
super({ ...defaults$p, ...options });
|
|
5057
5065
|
this.hasInvalidStyle = parseStyle$1(this.options.style);
|
|
5058
5066
|
}
|
|
5059
5067
|
static schema() {
|
|
@@ -5193,12 +5201,12 @@ function describePattern(pattern) {
|
|
|
5193
5201
|
}
|
|
5194
5202
|
}
|
|
5195
5203
|
|
|
5196
|
-
const defaults$
|
|
5204
|
+
const defaults$o = {
|
|
5197
5205
|
pattern: "kebabcase"
|
|
5198
5206
|
};
|
|
5199
5207
|
class ClassPattern extends Rule {
|
|
5200
5208
|
constructor(options) {
|
|
5201
|
-
super({ ...defaults$
|
|
5209
|
+
super({ ...defaults$o, ...options });
|
|
5202
5210
|
this.pattern = parsePattern(this.options.pattern);
|
|
5203
5211
|
}
|
|
5204
5212
|
static schema() {
|
|
@@ -5304,13 +5312,13 @@ class CloseOrder extends Rule {
|
|
|
5304
5312
|
}
|
|
5305
5313
|
}
|
|
5306
5314
|
|
|
5307
|
-
const defaults$
|
|
5315
|
+
const defaults$n = {
|
|
5308
5316
|
include: null,
|
|
5309
5317
|
exclude: null
|
|
5310
5318
|
};
|
|
5311
5319
|
class Deprecated extends Rule {
|
|
5312
5320
|
constructor(options) {
|
|
5313
|
-
super({ ...defaults$
|
|
5321
|
+
super({ ...defaults$n, ...options });
|
|
5314
5322
|
}
|
|
5315
5323
|
static schema() {
|
|
5316
5324
|
return {
|
|
@@ -5464,12 +5472,12 @@ let NoStyleTag$1 = class NoStyleTag extends Rule {
|
|
|
5464
5472
|
}
|
|
5465
5473
|
};
|
|
5466
5474
|
|
|
5467
|
-
const defaults$
|
|
5475
|
+
const defaults$m = {
|
|
5468
5476
|
style: "uppercase"
|
|
5469
5477
|
};
|
|
5470
5478
|
class DoctypeStyle extends Rule {
|
|
5471
5479
|
constructor(options) {
|
|
5472
|
-
super({ ...defaults$
|
|
5480
|
+
super({ ...defaults$m, ...options });
|
|
5473
5481
|
}
|
|
5474
5482
|
static schema() {
|
|
5475
5483
|
return {
|
|
@@ -5497,12 +5505,12 @@ class DoctypeStyle extends Rule {
|
|
|
5497
5505
|
}
|
|
5498
5506
|
}
|
|
5499
5507
|
|
|
5500
|
-
const defaults$
|
|
5508
|
+
const defaults$l = {
|
|
5501
5509
|
style: "lowercase"
|
|
5502
5510
|
};
|
|
5503
5511
|
class ElementCase extends Rule {
|
|
5504
5512
|
constructor(options) {
|
|
5505
|
-
super({ ...defaults$
|
|
5513
|
+
super({ ...defaults$l, ...options });
|
|
5506
5514
|
this.style = new CaseStyle(this.options.style, "element-case");
|
|
5507
5515
|
}
|
|
5508
5516
|
static schema() {
|
|
@@ -5562,14 +5570,14 @@ class ElementCase extends Rule {
|
|
|
5562
5570
|
}
|
|
5563
5571
|
}
|
|
5564
5572
|
|
|
5565
|
-
const defaults$
|
|
5573
|
+
const defaults$k = {
|
|
5566
5574
|
pattern: "^[a-z][a-z0-9\\-._]*-[a-z0-9\\-._]*$",
|
|
5567
5575
|
whitelist: [],
|
|
5568
5576
|
blacklist: []
|
|
5569
5577
|
};
|
|
5570
5578
|
class ElementName extends Rule {
|
|
5571
5579
|
constructor(options) {
|
|
5572
|
-
super({ ...defaults$
|
|
5580
|
+
super({ ...defaults$k, ...options });
|
|
5573
5581
|
this.pattern = new RegExp(this.options.pattern);
|
|
5574
5582
|
}
|
|
5575
5583
|
static schema() {
|
|
@@ -5606,7 +5614,7 @@ class ElementName extends Rule {
|
|
|
5606
5614
|
...context.blacklist.map((cur) => `- ${cur}`)
|
|
5607
5615
|
];
|
|
5608
5616
|
}
|
|
5609
|
-
if (context.pattern !== defaults$
|
|
5617
|
+
if (context.pattern !== defaults$k.pattern) {
|
|
5610
5618
|
return [
|
|
5611
5619
|
`<${context.tagName}> is not a valid element name. This project is configured to only allow names matching the following regular expression:`,
|
|
5612
5620
|
"",
|
|
@@ -6095,7 +6103,7 @@ class EmptyTitle extends Rule {
|
|
|
6095
6103
|
}
|
|
6096
6104
|
}
|
|
6097
6105
|
|
|
6098
|
-
const defaults$
|
|
6106
|
+
const defaults$j = {
|
|
6099
6107
|
allowArrayBrackets: true,
|
|
6100
6108
|
shared: ["radio", "button", "reset", "submit"]
|
|
6101
6109
|
};
|
|
@@ -6123,7 +6131,7 @@ function getDocumentation(context) {
|
|
|
6123
6131
|
}
|
|
6124
6132
|
class FormDupName extends Rule {
|
|
6125
6133
|
constructor(options) {
|
|
6126
|
-
super({ ...defaults$
|
|
6134
|
+
super({ ...defaults$j, ...options });
|
|
6127
6135
|
}
|
|
6128
6136
|
static schema() {
|
|
6129
6137
|
return {
|
|
@@ -6272,7 +6280,7 @@ class FormDupName extends Rule {
|
|
|
6272
6280
|
}
|
|
6273
6281
|
}
|
|
6274
6282
|
|
|
6275
|
-
const defaults$
|
|
6283
|
+
const defaults$i = {
|
|
6276
6284
|
allowMultipleH1: false,
|
|
6277
6285
|
minInitialRank: "h1",
|
|
6278
6286
|
sectioningRoots: ["dialog", '[role="dialog"]', '[role="alertdialog"]']
|
|
@@ -6301,7 +6309,7 @@ function parseMaxInitial(value) {
|
|
|
6301
6309
|
}
|
|
6302
6310
|
class HeadingLevel extends Rule {
|
|
6303
6311
|
constructor(options) {
|
|
6304
|
-
super({ ...defaults$
|
|
6312
|
+
super({ ...defaults$i, ...options });
|
|
6305
6313
|
this.stack = [];
|
|
6306
6314
|
this.minInitialRank = parseMaxInitial(this.options.minInitialRank);
|
|
6307
6315
|
this.sectionRoots = this.options.sectioningRoots.map((it) => new Pattern(it));
|
|
@@ -6504,12 +6512,12 @@ class HiddenFocusable extends Rule {
|
|
|
6504
6512
|
}
|
|
6505
6513
|
}
|
|
6506
6514
|
|
|
6507
|
-
const defaults$
|
|
6515
|
+
const defaults$h = {
|
|
6508
6516
|
pattern: "kebabcase"
|
|
6509
6517
|
};
|
|
6510
6518
|
class IdPattern extends Rule {
|
|
6511
6519
|
constructor(options) {
|
|
6512
|
-
super({ ...defaults$
|
|
6520
|
+
super({ ...defaults$h, ...options });
|
|
6513
6521
|
this.pattern = parsePattern(this.options.pattern);
|
|
6514
6522
|
}
|
|
6515
6523
|
static schema() {
|
|
@@ -6862,12 +6870,12 @@ function findLabelByParent(el) {
|
|
|
6862
6870
|
return [];
|
|
6863
6871
|
}
|
|
6864
6872
|
|
|
6865
|
-
const defaults$
|
|
6873
|
+
const defaults$g = {
|
|
6866
6874
|
maxlength: 70
|
|
6867
6875
|
};
|
|
6868
6876
|
class LongTitle extends Rule {
|
|
6869
6877
|
constructor(options) {
|
|
6870
|
-
super({ ...defaults$
|
|
6878
|
+
super({ ...defaults$g, ...options });
|
|
6871
6879
|
this.maxlength = this.options.maxlength;
|
|
6872
6880
|
}
|
|
6873
6881
|
static schema() {
|
|
@@ -6896,7 +6904,13 @@ class LongTitle extends Rule {
|
|
|
6896
6904
|
}
|
|
6897
6905
|
}
|
|
6898
6906
|
|
|
6907
|
+
const defaults$f = {
|
|
6908
|
+
allowLongDelay: false
|
|
6909
|
+
};
|
|
6899
6910
|
class MetaRefresh extends Rule {
|
|
6911
|
+
constructor(options) {
|
|
6912
|
+
super({ ...defaults$f, ...options });
|
|
6913
|
+
}
|
|
6900
6914
|
documentation() {
|
|
6901
6915
|
return {
|
|
6902
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.`,
|
|
@@ -6922,14 +6936,24 @@ class MetaRefresh extends Rule {
|
|
|
6922
6936
|
this.report(target, "Malformed meta refresh directive", location);
|
|
6923
6937
|
return;
|
|
6924
6938
|
}
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
}
|
|
6928
|
-
if (value.delay !== 0) {
|
|
6929
|
-
this.report(target, "Meta refresh must use 0 second delay", location);
|
|
6930
|
-
}
|
|
6939
|
+
const { delay, url } = value;
|
|
6940
|
+
this.validateDelay(target, location, delay, url);
|
|
6931
6941
|
});
|
|
6932
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
|
+
}
|
|
6933
6957
|
}
|
|
6934
6958
|
function parseContent(text) {
|
|
6935
6959
|
const match = text.match(/^(\d+)(?:\s*;\s*url=(.*))?/);
|
|
@@ -11974,7 +11998,7 @@ class HtmlValidate {
|
|
|
11974
11998
|
}
|
|
11975
11999
|
|
|
11976
12000
|
const name = "html-validate";
|
|
11977
|
-
const version = "8.
|
|
12001
|
+
const version = "8.14.0";
|
|
11978
12002
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
11979
12003
|
|
|
11980
12004
|
function definePlugin(plugin) {
|