html-validate 10.1.1 → 10.1.2
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/cli.js +200 -202
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/core-browser.js.map +1 -1
- package/dist/cjs/core-nodejs.js.map +1 -1
- package/dist/cjs/core.js +350 -314
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/html-validate.js +1 -2
- package/dist/cjs/html-validate.js.map +1 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/jest.js +1 -1
- package/dist/cjs/jest.js.map +1 -1
- package/dist/cjs/matchers-jestonly.js +1 -1
- package/dist/cjs/matchers-jestonly.js.map +1 -1
- package/dist/cjs/matchers.js.map +1 -1
- package/dist/cjs/test-utils.js +2 -2
- package/dist/cjs/test-utils.js.map +2 -2
- package/dist/cjs/tsdoc-metadata.json +1 -1
- package/dist/cjs/vitest.js.map +1 -1
- package/dist/esm/browser.js +1 -1
- package/dist/esm/cli.js +200 -201
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/core-browser.js.map +1 -1
- package/dist/esm/core-nodejs.js.map +1 -1
- package/dist/esm/core.js +351 -315
- package/dist/esm/core.js.map +1 -1
- package/dist/esm/html-validate.js +1 -2
- package/dist/esm/html-validate.js.map +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/jest.js +1 -1
- package/dist/esm/jest.js.map +1 -1
- package/dist/esm/matchers-jestonly.js +1 -1
- package/dist/esm/matchers-jestonly.js.map +1 -1
- package/dist/esm/matchers.js.map +1 -1
- package/dist/esm/test-utils.js +1 -1
- package/dist/esm/test-utils.js.map +1 -1
- package/dist/esm/vitest.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +1 -1
package/dist/esm/core.js
CHANGED
|
@@ -496,27 +496,6 @@ class SchemaValidationError extends UserError {
|
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
-
function cyrb53(str) {
|
|
500
|
-
const a = 2654435761;
|
|
501
|
-
const b = 1597334677;
|
|
502
|
-
const c = 2246822507;
|
|
503
|
-
const d = 3266489909;
|
|
504
|
-
const e = 4294967296;
|
|
505
|
-
const f = 2097151;
|
|
506
|
-
const seed = 0;
|
|
507
|
-
let h1 = 3735928559 ^ seed;
|
|
508
|
-
let h2 = 1103547991 ^ seed;
|
|
509
|
-
for (let i = 0, ch; i < str.length; i++) {
|
|
510
|
-
ch = str.charCodeAt(i);
|
|
511
|
-
h1 = Math.imul(h1 ^ ch, a);
|
|
512
|
-
h2 = Math.imul(h2 ^ ch, b);
|
|
513
|
-
}
|
|
514
|
-
h1 = Math.imul(h1 ^ h1 >>> 16, c) ^ Math.imul(h2 ^ h2 >>> 13, d);
|
|
515
|
-
h2 = Math.imul(h2 ^ h2 >>> 16, c) ^ Math.imul(h1 ^ h1 >>> 13, d);
|
|
516
|
-
return e * (f & h2) + (h1 >>> 0);
|
|
517
|
-
}
|
|
518
|
-
const computeHash = cyrb53;
|
|
519
|
-
|
|
520
499
|
const $schema$1 = "http://json-schema.org/draft-06/schema#";
|
|
521
500
|
const $id$1 = "https://html-validate.org/schemas/elements.json";
|
|
522
501
|
const type$1 = "object";
|
|
@@ -992,6 +971,27 @@ const ajvFunctionKeyword = {
|
|
|
992
971
|
validate: ajvFunctionValidate
|
|
993
972
|
};
|
|
994
973
|
|
|
974
|
+
function cyrb53(str) {
|
|
975
|
+
const a = 2654435761;
|
|
976
|
+
const b = 1597334677;
|
|
977
|
+
const c = 2246822507;
|
|
978
|
+
const d = 3266489909;
|
|
979
|
+
const e = 4294967296;
|
|
980
|
+
const f = 2097151;
|
|
981
|
+
const seed = 0;
|
|
982
|
+
let h1 = 3735928559 ^ seed;
|
|
983
|
+
let h2 = 1103547991 ^ seed;
|
|
984
|
+
for (let i = 0, ch; i < str.length; i++) {
|
|
985
|
+
ch = str.charCodeAt(i);
|
|
986
|
+
h1 = Math.imul(h1 ^ ch, a);
|
|
987
|
+
h2 = Math.imul(h2 ^ ch, b);
|
|
988
|
+
}
|
|
989
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, c) ^ Math.imul(h2 ^ h2 >>> 13, d);
|
|
990
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, c) ^ Math.imul(h1 ^ h1 >>> 13, d);
|
|
991
|
+
return e * (f & h2) + (h1 >>> 0);
|
|
992
|
+
}
|
|
993
|
+
const computeHash = cyrb53;
|
|
994
|
+
|
|
995
995
|
var TextContent$1 = /* @__PURE__ */ ((TextContent2) => {
|
|
996
996
|
TextContent2["NONE"] = "none";
|
|
997
997
|
TextContent2["DEFAULT"] = "default";
|
|
@@ -1592,7 +1592,6 @@ class DOMNode {
|
|
|
1592
1592
|
* @internal
|
|
1593
1593
|
*/
|
|
1594
1594
|
unique;
|
|
1595
|
-
/* eslint-disable-next-line sonarjs/use-type-alias -- technical debt */
|
|
1596
1595
|
cache;
|
|
1597
1596
|
/**
|
|
1598
1597
|
* Set of disabled rules for this node.
|
|
@@ -1632,8 +1631,8 @@ class DOMNode {
|
|
|
1632
1631
|
*
|
|
1633
1632
|
* @internal
|
|
1634
1633
|
*/
|
|
1635
|
-
cacheEnable() {
|
|
1636
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
1634
|
+
cacheEnable(enable = true) {
|
|
1635
|
+
this.cache = enable ? /* @__PURE__ */ new Map() : null;
|
|
1637
1636
|
}
|
|
1638
1637
|
cacheGet(key) {
|
|
1639
1638
|
if (this.cache) {
|
|
@@ -3320,172 +3319,6 @@ function parseQuantifier(quantifier) {
|
|
|
3320
3319
|
}
|
|
3321
3320
|
}
|
|
3322
3321
|
|
|
3323
|
-
const $schema = "http://json-schema.org/draft-06/schema#";
|
|
3324
|
-
const $id = "https://html-validate.org/schemas/config.json";
|
|
3325
|
-
const type = "object";
|
|
3326
|
-
const additionalProperties = false;
|
|
3327
|
-
const properties = {
|
|
3328
|
-
$schema: {
|
|
3329
|
-
type: "string"
|
|
3330
|
-
},
|
|
3331
|
-
root: {
|
|
3332
|
-
type: "boolean",
|
|
3333
|
-
title: "Mark as root configuration",
|
|
3334
|
-
description: "If this is set to true no further configurations will be searched.",
|
|
3335
|
-
"default": false
|
|
3336
|
-
},
|
|
3337
|
-
"extends": {
|
|
3338
|
-
type: "array",
|
|
3339
|
-
items: {
|
|
3340
|
-
type: "string"
|
|
3341
|
-
},
|
|
3342
|
-
title: "Configurations to extend",
|
|
3343
|
-
description: "Array of shareable or builtin configurations to extend."
|
|
3344
|
-
},
|
|
3345
|
-
elements: {
|
|
3346
|
-
type: "array",
|
|
3347
|
-
items: {
|
|
3348
|
-
anyOf: [
|
|
3349
|
-
{
|
|
3350
|
-
type: "string"
|
|
3351
|
-
},
|
|
3352
|
-
{
|
|
3353
|
-
type: "object"
|
|
3354
|
-
}
|
|
3355
|
-
]
|
|
3356
|
-
},
|
|
3357
|
-
title: "Element metadata to load",
|
|
3358
|
-
description: "Array of modules, plugins or files to load element metadata from. Use <rootDir> to refer to the folder with the package.json file.",
|
|
3359
|
-
examples: [
|
|
3360
|
-
[
|
|
3361
|
-
"html-validate:recommended",
|
|
3362
|
-
"plugin:recommended",
|
|
3363
|
-
"module",
|
|
3364
|
-
"./local-file.json"
|
|
3365
|
-
]
|
|
3366
|
-
]
|
|
3367
|
-
},
|
|
3368
|
-
plugins: {
|
|
3369
|
-
type: "array",
|
|
3370
|
-
items: {
|
|
3371
|
-
anyOf: [
|
|
3372
|
-
{
|
|
3373
|
-
type: "string"
|
|
3374
|
-
},
|
|
3375
|
-
{
|
|
3376
|
-
type: "object"
|
|
3377
|
-
}
|
|
3378
|
-
]
|
|
3379
|
-
},
|
|
3380
|
-
title: "Plugins to load",
|
|
3381
|
-
description: "Array of plugins load. Use <rootDir> to refer to the folder with the package.json file.",
|
|
3382
|
-
examples: [
|
|
3383
|
-
[
|
|
3384
|
-
"my-plugin",
|
|
3385
|
-
"./local-plugin"
|
|
3386
|
-
]
|
|
3387
|
-
]
|
|
3388
|
-
},
|
|
3389
|
-
transform: {
|
|
3390
|
-
type: "object",
|
|
3391
|
-
additionalProperties: {
|
|
3392
|
-
anyOf: [
|
|
3393
|
-
{
|
|
3394
|
-
type: "string"
|
|
3395
|
-
},
|
|
3396
|
-
{
|
|
3397
|
-
"function": true
|
|
3398
|
-
}
|
|
3399
|
-
]
|
|
3400
|
-
},
|
|
3401
|
-
title: "File transformations to use.",
|
|
3402
|
-
description: "Object where key is regular expression to match filename and value is name of transformer or a function.",
|
|
3403
|
-
examples: [
|
|
3404
|
-
{
|
|
3405
|
-
"^.*\\.foo$": "my-transformer",
|
|
3406
|
-
"^.*\\.bar$": "my-plugin",
|
|
3407
|
-
"^.*\\.baz$": "my-plugin:named"
|
|
3408
|
-
}
|
|
3409
|
-
]
|
|
3410
|
-
},
|
|
3411
|
-
rules: {
|
|
3412
|
-
type: "object",
|
|
3413
|
-
patternProperties: {
|
|
3414
|
-
".*": {
|
|
3415
|
-
anyOf: [
|
|
3416
|
-
{
|
|
3417
|
-
"enum": [
|
|
3418
|
-
0,
|
|
3419
|
-
1,
|
|
3420
|
-
2,
|
|
3421
|
-
"off",
|
|
3422
|
-
"warn",
|
|
3423
|
-
"error"
|
|
3424
|
-
]
|
|
3425
|
-
},
|
|
3426
|
-
{
|
|
3427
|
-
type: "array",
|
|
3428
|
-
minItems: 1,
|
|
3429
|
-
maxItems: 1,
|
|
3430
|
-
items: [
|
|
3431
|
-
{
|
|
3432
|
-
"enum": [
|
|
3433
|
-
0,
|
|
3434
|
-
1,
|
|
3435
|
-
2,
|
|
3436
|
-
"off",
|
|
3437
|
-
"warn",
|
|
3438
|
-
"error"
|
|
3439
|
-
]
|
|
3440
|
-
}
|
|
3441
|
-
]
|
|
3442
|
-
},
|
|
3443
|
-
{
|
|
3444
|
-
type: "array",
|
|
3445
|
-
minItems: 2,
|
|
3446
|
-
maxItems: 2,
|
|
3447
|
-
items: [
|
|
3448
|
-
{
|
|
3449
|
-
"enum": [
|
|
3450
|
-
0,
|
|
3451
|
-
1,
|
|
3452
|
-
2,
|
|
3453
|
-
"off",
|
|
3454
|
-
"warn",
|
|
3455
|
-
"error"
|
|
3456
|
-
]
|
|
3457
|
-
},
|
|
3458
|
-
{
|
|
3459
|
-
}
|
|
3460
|
-
]
|
|
3461
|
-
}
|
|
3462
|
-
]
|
|
3463
|
-
}
|
|
3464
|
-
},
|
|
3465
|
-
title: "Rule configuration.",
|
|
3466
|
-
description: "Enable/disable rules, set severity. Some rules have additional configuration like style or patterns to use.",
|
|
3467
|
-
examples: [
|
|
3468
|
-
{
|
|
3469
|
-
foo: "error",
|
|
3470
|
-
bar: "off",
|
|
3471
|
-
baz: [
|
|
3472
|
-
"error",
|
|
3473
|
-
{
|
|
3474
|
-
style: "camelcase"
|
|
3475
|
-
}
|
|
3476
|
-
]
|
|
3477
|
-
}
|
|
3478
|
-
]
|
|
3479
|
-
}
|
|
3480
|
-
};
|
|
3481
|
-
var configurationSchema = {
|
|
3482
|
-
$schema: $schema,
|
|
3483
|
-
$id: $id,
|
|
3484
|
-
type: type,
|
|
3485
|
-
additionalProperties: additionalProperties,
|
|
3486
|
-
properties: properties
|
|
3487
|
-
};
|
|
3488
|
-
|
|
3489
3322
|
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
3490
3323
|
Severity2[Severity2["DISABLED"] = 0] = "DISABLED";
|
|
3491
3324
|
Severity2[Severity2["WARN"] = 1] = "WARN";
|
|
@@ -3508,35 +3341,6 @@ function parseSeverity(value) {
|
|
|
3508
3341
|
}
|
|
3509
3342
|
}
|
|
3510
3343
|
|
|
3511
|
-
function escape(value) {
|
|
3512
|
-
return JSON.stringify(value);
|
|
3513
|
-
}
|
|
3514
|
-
function format(value, quote = false) {
|
|
3515
|
-
if (value === null || value === void 0) {
|
|
3516
|
-
return "null";
|
|
3517
|
-
}
|
|
3518
|
-
if (typeof value === "number") {
|
|
3519
|
-
return value.toString();
|
|
3520
|
-
}
|
|
3521
|
-
if (typeof value === "string") {
|
|
3522
|
-
return quote ? escape(value) : value;
|
|
3523
|
-
}
|
|
3524
|
-
if (Array.isArray(value)) {
|
|
3525
|
-
const content = value.map((it) => format(it, true)).join(", ");
|
|
3526
|
-
return `[ ${content} ]`;
|
|
3527
|
-
}
|
|
3528
|
-
if (typeof value === "object") {
|
|
3529
|
-
const content = Object.entries(value).map(([key, nested]) => `${key}: ${format(nested, true)}`).join(", ");
|
|
3530
|
-
return `{ ${content} }`;
|
|
3531
|
-
}
|
|
3532
|
-
return String(value);
|
|
3533
|
-
}
|
|
3534
|
-
function interpolate(text, data) {
|
|
3535
|
-
return text.replace(/{{\s*([^\s{}]+)\s*}}/g, (match, key) => {
|
|
3536
|
-
return typeof data[key] !== "undefined" ? format(data[key]) : match;
|
|
3537
|
-
});
|
|
3538
|
-
}
|
|
3539
|
-
|
|
3540
3344
|
const cacheKey = Symbol("aria-naming");
|
|
3541
3345
|
const defaultValue = "allowed";
|
|
3542
3346
|
const prohibitedRoles = [
|
|
@@ -3578,6 +3382,31 @@ function ariaNaming(element) {
|
|
|
3578
3382
|
return element.cacheSet(cacheKey, byMeta(element, meta));
|
|
3579
3383
|
}
|
|
3580
3384
|
|
|
3385
|
+
const INPUT_DISABLED_CACHE = Symbol(isInputDisabled.name);
|
|
3386
|
+
function isInputDisabled(node, details) {
|
|
3387
|
+
const cached = node.cacheGet(INPUT_DISABLED_CACHE);
|
|
3388
|
+
if (cached) {
|
|
3389
|
+
return details ? cached : cached.byFieldset || cached.bySelf;
|
|
3390
|
+
}
|
|
3391
|
+
const result = node.cacheSet(INPUT_DISABLED_CACHE, isInputDisabledImpl(node));
|
|
3392
|
+
return details ? result : result.byFieldset || result.bySelf;
|
|
3393
|
+
}
|
|
3394
|
+
function isInputDisabledImpl(node) {
|
|
3395
|
+
const hasDisabledAttr = (node2) => {
|
|
3396
|
+
const disabled = node2.getAttribute("disabled");
|
|
3397
|
+
return Boolean(disabled?.isStatic);
|
|
3398
|
+
};
|
|
3399
|
+
const hasDisabledFieldset = (node2) => {
|
|
3400
|
+
const fieldset = node2.closest("fieldset[disabled]");
|
|
3401
|
+
const disabled = fieldset?.getAttribute("disabled");
|
|
3402
|
+
return Boolean(disabled?.isStatic);
|
|
3403
|
+
};
|
|
3404
|
+
return {
|
|
3405
|
+
byFieldset: hasDisabledFieldset(node),
|
|
3406
|
+
bySelf: hasDisabledAttr(node)
|
|
3407
|
+
};
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3581
3410
|
const patternCache = /* @__PURE__ */ new Map();
|
|
3582
3411
|
function compileStringPattern(pattern) {
|
|
3583
3412
|
const regexp = pattern.replace(/[*]+/g, ".+");
|
|
@@ -3831,6 +3660,35 @@ function partition(values, predicate) {
|
|
|
3831
3660
|
}, initial);
|
|
3832
3661
|
}
|
|
3833
3662
|
|
|
3663
|
+
function escape(value) {
|
|
3664
|
+
return JSON.stringify(value);
|
|
3665
|
+
}
|
|
3666
|
+
function format(value, quote = false) {
|
|
3667
|
+
if (value === null || value === void 0) {
|
|
3668
|
+
return "null";
|
|
3669
|
+
}
|
|
3670
|
+
if (typeof value === "number") {
|
|
3671
|
+
return value.toString();
|
|
3672
|
+
}
|
|
3673
|
+
if (typeof value === "string") {
|
|
3674
|
+
return quote ? escape(value) : value;
|
|
3675
|
+
}
|
|
3676
|
+
if (Array.isArray(value)) {
|
|
3677
|
+
const content = value.map((it) => format(it, true)).join(", ");
|
|
3678
|
+
return `[ ${content} ]`;
|
|
3679
|
+
}
|
|
3680
|
+
if (typeof value === "object") {
|
|
3681
|
+
const content = Object.entries(value).map(([key, nested]) => `${key}: ${format(nested, true)}`).join(", ");
|
|
3682
|
+
return `{ ${content} }`;
|
|
3683
|
+
}
|
|
3684
|
+
return String(value);
|
|
3685
|
+
}
|
|
3686
|
+
function interpolate(text, data) {
|
|
3687
|
+
return text.replace(/{{\s*([^\s{}]+)\s*}}/g, (match, key) => {
|
|
3688
|
+
return typeof data[key] !== "undefined" ? format(data[key]) : match;
|
|
3689
|
+
});
|
|
3690
|
+
}
|
|
3691
|
+
|
|
3834
3692
|
const ajv$1 = new Ajv({ strict: true, strictTuples: true, strictTypes: true });
|
|
3835
3693
|
ajv$1.addMetaSchema(ajvSchemaDraft);
|
|
3836
3694
|
function getSchemaValidator(ruleId, properties) {
|
|
@@ -6519,6 +6377,18 @@ const defaults$l = {
|
|
|
6519
6377
|
};
|
|
6520
6378
|
const UNIQUE_CACHE_KEY = Symbol("form-elements-unique");
|
|
6521
6379
|
const SHARED_CACHE_KEY = Symbol("form-elements-shared");
|
|
6380
|
+
function isEnabled(element) {
|
|
6381
|
+
if (isHTMLHidden(element)) {
|
|
6382
|
+
return false;
|
|
6383
|
+
}
|
|
6384
|
+
if (isInert(element)) {
|
|
6385
|
+
return false;
|
|
6386
|
+
}
|
|
6387
|
+
if (isInputDisabled(element)) {
|
|
6388
|
+
return false;
|
|
6389
|
+
}
|
|
6390
|
+
return true;
|
|
6391
|
+
}
|
|
6522
6392
|
function haveName(name) {
|
|
6523
6393
|
return typeof name === "string" && name !== "";
|
|
6524
6394
|
}
|
|
@@ -6589,7 +6459,7 @@ class FormDupName extends Rule {
|
|
|
6589
6459
|
const { shared } = this.options;
|
|
6590
6460
|
this.on("dom:ready", (event) => {
|
|
6591
6461
|
const { document } = event;
|
|
6592
|
-
const controls = document.querySelectorAll(selector);
|
|
6462
|
+
const controls = document.querySelectorAll(selector).filter(isEnabled);
|
|
6593
6463
|
const [sharedControls, uniqueControls] = partition(controls, (it) => {
|
|
6594
6464
|
return allowSharedName(it, shared);
|
|
6595
6465
|
});
|
|
@@ -7345,69 +7215,6 @@ class LongTitle extends Rule {
|
|
|
7345
7215
|
}
|
|
7346
7216
|
}
|
|
7347
7217
|
|
|
7348
|
-
const defaults$h = {
|
|
7349
|
-
allowLongDelay: false
|
|
7350
|
-
};
|
|
7351
|
-
class MetaRefresh extends Rule {
|
|
7352
|
-
constructor(options) {
|
|
7353
|
-
super({ ...defaults$h, ...options });
|
|
7354
|
-
}
|
|
7355
|
-
documentation() {
|
|
7356
|
-
return {
|
|
7357
|
-
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.`,
|
|
7358
|
-
url: "https://html-validate.org/rules/meta-refresh.html"
|
|
7359
|
-
};
|
|
7360
|
-
}
|
|
7361
|
-
setup() {
|
|
7362
|
-
this.on("element:ready", ({ target }) => {
|
|
7363
|
-
if (!target.is("meta")) {
|
|
7364
|
-
return;
|
|
7365
|
-
}
|
|
7366
|
-
const httpEquiv = target.getAttributeValue("http-equiv");
|
|
7367
|
-
if (httpEquiv !== "refresh") {
|
|
7368
|
-
return;
|
|
7369
|
-
}
|
|
7370
|
-
const content = target.getAttribute("content");
|
|
7371
|
-
if (!content?.value || content.isDynamic) {
|
|
7372
|
-
return;
|
|
7373
|
-
}
|
|
7374
|
-
const location = content.valueLocation;
|
|
7375
|
-
const value = parseContent(content.value.toString());
|
|
7376
|
-
if (!value) {
|
|
7377
|
-
this.report(target, "Malformed meta refresh directive", location);
|
|
7378
|
-
return;
|
|
7379
|
-
}
|
|
7380
|
-
const { delay, url } = value;
|
|
7381
|
-
this.validateDelay(target, location, delay, url);
|
|
7382
|
-
});
|
|
7383
|
-
}
|
|
7384
|
-
validateDelay(target, location, delay, url) {
|
|
7385
|
-
const { allowLongDelay } = this.options;
|
|
7386
|
-
if (allowLongDelay && delay > 72e3) {
|
|
7387
|
-
return;
|
|
7388
|
-
}
|
|
7389
|
-
if (!url && delay === 0) {
|
|
7390
|
-
this.report(target, "Don't use instant meta refresh to reload the page", location);
|
|
7391
|
-
return;
|
|
7392
|
-
}
|
|
7393
|
-
if (delay !== 0) {
|
|
7394
|
-
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)";
|
|
7395
|
-
this.report(target, message, location);
|
|
7396
|
-
}
|
|
7397
|
-
}
|
|
7398
|
-
}
|
|
7399
|
-
function parseContent(text) {
|
|
7400
|
-
const match = /^(\d+)(?:\s*;\s*url=(.*))?/i.exec(text);
|
|
7401
|
-
if (match) {
|
|
7402
|
-
return {
|
|
7403
|
-
delay: parseInt(match[1], 10),
|
|
7404
|
-
url: match[2]
|
|
7405
|
-
};
|
|
7406
|
-
} else {
|
|
7407
|
-
return null;
|
|
7408
|
-
}
|
|
7409
|
-
}
|
|
7410
|
-
|
|
7411
7218
|
function getName(attr) {
|
|
7412
7219
|
const name = attr.value;
|
|
7413
7220
|
if (!name || name instanceof DynamicValue) {
|
|
@@ -7470,16 +7277,79 @@ class MapIdName extends Rule {
|
|
|
7470
7277
|
if (!hasStaticValue(id) || !hasStaticValue(name)) {
|
|
7471
7278
|
return;
|
|
7472
7279
|
}
|
|
7473
|
-
if (id.value === name.value) {
|
|
7280
|
+
if (id.value === name.value) {
|
|
7281
|
+
return;
|
|
7282
|
+
}
|
|
7283
|
+
this.report({
|
|
7284
|
+
node: event.target,
|
|
7285
|
+
message: `"id" and "name" attribute must be the same on <map> elements`,
|
|
7286
|
+
location: id.valueLocation ?? name.valueLocation
|
|
7287
|
+
});
|
|
7288
|
+
});
|
|
7289
|
+
}
|
|
7290
|
+
}
|
|
7291
|
+
|
|
7292
|
+
const defaults$h = {
|
|
7293
|
+
allowLongDelay: false
|
|
7294
|
+
};
|
|
7295
|
+
class MetaRefresh extends Rule {
|
|
7296
|
+
constructor(options) {
|
|
7297
|
+
super({ ...defaults$h, ...options });
|
|
7298
|
+
}
|
|
7299
|
+
documentation() {
|
|
7300
|
+
return {
|
|
7301
|
+
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.`,
|
|
7302
|
+
url: "https://html-validate.org/rules/meta-refresh.html"
|
|
7303
|
+
};
|
|
7304
|
+
}
|
|
7305
|
+
setup() {
|
|
7306
|
+
this.on("element:ready", ({ target }) => {
|
|
7307
|
+
if (!target.is("meta")) {
|
|
7308
|
+
return;
|
|
7309
|
+
}
|
|
7310
|
+
const httpEquiv = target.getAttributeValue("http-equiv");
|
|
7311
|
+
if (httpEquiv !== "refresh") {
|
|
7312
|
+
return;
|
|
7313
|
+
}
|
|
7314
|
+
const content = target.getAttribute("content");
|
|
7315
|
+
if (!content?.value || content.isDynamic) {
|
|
7474
7316
|
return;
|
|
7475
7317
|
}
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7318
|
+
const location = content.valueLocation;
|
|
7319
|
+
const value = parseContent(content.value.toString());
|
|
7320
|
+
if (!value) {
|
|
7321
|
+
this.report(target, "Malformed meta refresh directive", location);
|
|
7322
|
+
return;
|
|
7323
|
+
}
|
|
7324
|
+
const { delay, url } = value;
|
|
7325
|
+
this.validateDelay(target, location, delay, url);
|
|
7481
7326
|
});
|
|
7482
7327
|
}
|
|
7328
|
+
validateDelay(target, location, delay, url) {
|
|
7329
|
+
const { allowLongDelay } = this.options;
|
|
7330
|
+
if (allowLongDelay && delay > 72e3) {
|
|
7331
|
+
return;
|
|
7332
|
+
}
|
|
7333
|
+
if (!url && delay === 0) {
|
|
7334
|
+
this.report(target, "Don't use instant meta refresh to reload the page", location);
|
|
7335
|
+
return;
|
|
7336
|
+
}
|
|
7337
|
+
if (delay !== 0) {
|
|
7338
|
+
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)";
|
|
7339
|
+
this.report(target, message, location);
|
|
7340
|
+
}
|
|
7341
|
+
}
|
|
7342
|
+
}
|
|
7343
|
+
function parseContent(text) {
|
|
7344
|
+
const match = /^(\d+)(?:\s*;\s*url=(.*))?/i.exec(text);
|
|
7345
|
+
if (match) {
|
|
7346
|
+
return {
|
|
7347
|
+
delay: parseInt(match[1], 10),
|
|
7348
|
+
url: match[2]
|
|
7349
|
+
};
|
|
7350
|
+
} else {
|
|
7351
|
+
return null;
|
|
7352
|
+
}
|
|
7483
7353
|
}
|
|
7484
7354
|
|
|
7485
7355
|
class MissingDoctype extends Rule {
|
|
@@ -7878,30 +7748,6 @@ class NoImplicitButtonType extends Rule {
|
|
|
7878
7748
|
}
|
|
7879
7749
|
}
|
|
7880
7750
|
|
|
7881
|
-
function isRelevant$1(event) {
|
|
7882
|
-
return event.target.is("input");
|
|
7883
|
-
}
|
|
7884
|
-
class NoImplicitInputType extends Rule {
|
|
7885
|
-
documentation() {
|
|
7886
|
-
return {
|
|
7887
|
-
description: ["`<input>` is missing recommended `type` attribute"].join("\n"),
|
|
7888
|
-
url: "https://html-validate.org/rules/no-implicit-input-type.html"
|
|
7889
|
-
};
|
|
7890
|
-
}
|
|
7891
|
-
setup() {
|
|
7892
|
-
this.on("element:ready", isRelevant$1, (event) => {
|
|
7893
|
-
const { target } = event;
|
|
7894
|
-
const attr = target.getAttribute("type");
|
|
7895
|
-
if (!attr) {
|
|
7896
|
-
this.report({
|
|
7897
|
-
node: event.target,
|
|
7898
|
-
message: `<input> is missing recommended "type" attribute`
|
|
7899
|
-
});
|
|
7900
|
-
}
|
|
7901
|
-
});
|
|
7902
|
-
}
|
|
7903
|
-
}
|
|
7904
|
-
|
|
7905
7751
|
class NoImplicitClose extends Rule {
|
|
7906
7752
|
documentation() {
|
|
7907
7753
|
return {
|
|
@@ -7954,6 +7800,30 @@ Omitted end tags can be ambigious for humans to read and many editors have troub
|
|
|
7954
7800
|
}
|
|
7955
7801
|
}
|
|
7956
7802
|
|
|
7803
|
+
function isRelevant$1(event) {
|
|
7804
|
+
return event.target.is("input");
|
|
7805
|
+
}
|
|
7806
|
+
class NoImplicitInputType extends Rule {
|
|
7807
|
+
documentation() {
|
|
7808
|
+
return {
|
|
7809
|
+
description: ["`<input>` is missing recommended `type` attribute"].join("\n"),
|
|
7810
|
+
url: "https://html-validate.org/rules/no-implicit-input-type.html"
|
|
7811
|
+
};
|
|
7812
|
+
}
|
|
7813
|
+
setup() {
|
|
7814
|
+
this.on("element:ready", isRelevant$1, (event) => {
|
|
7815
|
+
const { target } = event;
|
|
7816
|
+
const attr = target.getAttribute("type");
|
|
7817
|
+
if (!attr) {
|
|
7818
|
+
this.report({
|
|
7819
|
+
node: event.target,
|
|
7820
|
+
message: `<input> is missing recommended "type" attribute`
|
|
7821
|
+
});
|
|
7822
|
+
}
|
|
7823
|
+
});
|
|
7824
|
+
}
|
|
7825
|
+
}
|
|
7826
|
+
|
|
7957
7827
|
const defaults$e = {
|
|
7958
7828
|
include: null,
|
|
7959
7829
|
exclude: null,
|
|
@@ -10707,6 +10577,172 @@ const bundledRules = {
|
|
|
10707
10577
|
...bundledRules$1
|
|
10708
10578
|
};
|
|
10709
10579
|
|
|
10580
|
+
const $schema = "http://json-schema.org/draft-06/schema#";
|
|
10581
|
+
const $id = "https://html-validate.org/schemas/config.json";
|
|
10582
|
+
const type = "object";
|
|
10583
|
+
const additionalProperties = false;
|
|
10584
|
+
const properties = {
|
|
10585
|
+
$schema: {
|
|
10586
|
+
type: "string"
|
|
10587
|
+
},
|
|
10588
|
+
root: {
|
|
10589
|
+
type: "boolean",
|
|
10590
|
+
title: "Mark as root configuration",
|
|
10591
|
+
description: "If this is set to true no further configurations will be searched.",
|
|
10592
|
+
"default": false
|
|
10593
|
+
},
|
|
10594
|
+
"extends": {
|
|
10595
|
+
type: "array",
|
|
10596
|
+
items: {
|
|
10597
|
+
type: "string"
|
|
10598
|
+
},
|
|
10599
|
+
title: "Configurations to extend",
|
|
10600
|
+
description: "Array of shareable or builtin configurations to extend."
|
|
10601
|
+
},
|
|
10602
|
+
elements: {
|
|
10603
|
+
type: "array",
|
|
10604
|
+
items: {
|
|
10605
|
+
anyOf: [
|
|
10606
|
+
{
|
|
10607
|
+
type: "string"
|
|
10608
|
+
},
|
|
10609
|
+
{
|
|
10610
|
+
type: "object"
|
|
10611
|
+
}
|
|
10612
|
+
]
|
|
10613
|
+
},
|
|
10614
|
+
title: "Element metadata to load",
|
|
10615
|
+
description: "Array of modules, plugins or files to load element metadata from. Use <rootDir> to refer to the folder with the package.json file.",
|
|
10616
|
+
examples: [
|
|
10617
|
+
[
|
|
10618
|
+
"html-validate:recommended",
|
|
10619
|
+
"plugin:recommended",
|
|
10620
|
+
"module",
|
|
10621
|
+
"./local-file.json"
|
|
10622
|
+
]
|
|
10623
|
+
]
|
|
10624
|
+
},
|
|
10625
|
+
plugins: {
|
|
10626
|
+
type: "array",
|
|
10627
|
+
items: {
|
|
10628
|
+
anyOf: [
|
|
10629
|
+
{
|
|
10630
|
+
type: "string"
|
|
10631
|
+
},
|
|
10632
|
+
{
|
|
10633
|
+
type: "object"
|
|
10634
|
+
}
|
|
10635
|
+
]
|
|
10636
|
+
},
|
|
10637
|
+
title: "Plugins to load",
|
|
10638
|
+
description: "Array of plugins load. Use <rootDir> to refer to the folder with the package.json file.",
|
|
10639
|
+
examples: [
|
|
10640
|
+
[
|
|
10641
|
+
"my-plugin",
|
|
10642
|
+
"./local-plugin"
|
|
10643
|
+
]
|
|
10644
|
+
]
|
|
10645
|
+
},
|
|
10646
|
+
transform: {
|
|
10647
|
+
type: "object",
|
|
10648
|
+
additionalProperties: {
|
|
10649
|
+
anyOf: [
|
|
10650
|
+
{
|
|
10651
|
+
type: "string"
|
|
10652
|
+
},
|
|
10653
|
+
{
|
|
10654
|
+
"function": true
|
|
10655
|
+
}
|
|
10656
|
+
]
|
|
10657
|
+
},
|
|
10658
|
+
title: "File transformations to use.",
|
|
10659
|
+
description: "Object where key is regular expression to match filename and value is name of transformer or a function.",
|
|
10660
|
+
examples: [
|
|
10661
|
+
{
|
|
10662
|
+
"^.*\\.foo$": "my-transformer",
|
|
10663
|
+
"^.*\\.bar$": "my-plugin",
|
|
10664
|
+
"^.*\\.baz$": "my-plugin:named"
|
|
10665
|
+
}
|
|
10666
|
+
]
|
|
10667
|
+
},
|
|
10668
|
+
rules: {
|
|
10669
|
+
type: "object",
|
|
10670
|
+
patternProperties: {
|
|
10671
|
+
".*": {
|
|
10672
|
+
anyOf: [
|
|
10673
|
+
{
|
|
10674
|
+
"enum": [
|
|
10675
|
+
0,
|
|
10676
|
+
1,
|
|
10677
|
+
2,
|
|
10678
|
+
"off",
|
|
10679
|
+
"warn",
|
|
10680
|
+
"error"
|
|
10681
|
+
]
|
|
10682
|
+
},
|
|
10683
|
+
{
|
|
10684
|
+
type: "array",
|
|
10685
|
+
minItems: 1,
|
|
10686
|
+
maxItems: 1,
|
|
10687
|
+
items: [
|
|
10688
|
+
{
|
|
10689
|
+
"enum": [
|
|
10690
|
+
0,
|
|
10691
|
+
1,
|
|
10692
|
+
2,
|
|
10693
|
+
"off",
|
|
10694
|
+
"warn",
|
|
10695
|
+
"error"
|
|
10696
|
+
]
|
|
10697
|
+
}
|
|
10698
|
+
]
|
|
10699
|
+
},
|
|
10700
|
+
{
|
|
10701
|
+
type: "array",
|
|
10702
|
+
minItems: 2,
|
|
10703
|
+
maxItems: 2,
|
|
10704
|
+
items: [
|
|
10705
|
+
{
|
|
10706
|
+
"enum": [
|
|
10707
|
+
0,
|
|
10708
|
+
1,
|
|
10709
|
+
2,
|
|
10710
|
+
"off",
|
|
10711
|
+
"warn",
|
|
10712
|
+
"error"
|
|
10713
|
+
]
|
|
10714
|
+
},
|
|
10715
|
+
{
|
|
10716
|
+
}
|
|
10717
|
+
]
|
|
10718
|
+
}
|
|
10719
|
+
]
|
|
10720
|
+
}
|
|
10721
|
+
},
|
|
10722
|
+
title: "Rule configuration.",
|
|
10723
|
+
description: "Enable/disable rules, set severity. Some rules have additional configuration like style or patterns to use.",
|
|
10724
|
+
examples: [
|
|
10725
|
+
{
|
|
10726
|
+
foo: "error",
|
|
10727
|
+
bar: "off",
|
|
10728
|
+
baz: [
|
|
10729
|
+
"error",
|
|
10730
|
+
{
|
|
10731
|
+
style: "camelcase"
|
|
10732
|
+
}
|
|
10733
|
+
]
|
|
10734
|
+
}
|
|
10735
|
+
]
|
|
10736
|
+
}
|
|
10737
|
+
};
|
|
10738
|
+
var configurationSchema = {
|
|
10739
|
+
$schema: $schema,
|
|
10740
|
+
$id: $id,
|
|
10741
|
+
type: type,
|
|
10742
|
+
additionalProperties: additionalProperties,
|
|
10743
|
+
properties: properties
|
|
10744
|
+
};
|
|
10745
|
+
|
|
10710
10746
|
function dumpTree(root) {
|
|
10711
10747
|
const lines = [];
|
|
10712
10748
|
function decoration(node) {
|
|
@@ -11842,7 +11878,7 @@ class EventHandler {
|
|
|
11842
11878
|
}
|
|
11843
11879
|
|
|
11844
11880
|
const name = "html-validate";
|
|
11845
|
-
const version = "10.1.
|
|
11881
|
+
const version = "10.1.2";
|
|
11846
11882
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
11847
11883
|
|
|
11848
11884
|
function freeze(src) {
|
|
@@ -14246,5 +14282,5 @@ const engines = {
|
|
|
14246
14282
|
|
|
14247
14283
|
var workerPath = "./jest-worker.js";
|
|
14248
14284
|
|
|
14249
|
-
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,
|
|
14285
|
+
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 };
|
|
14250
14286
|
//# sourceMappingURL=core.js.map
|