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/cjs/core.js
CHANGED
|
@@ -505,27 +505,6 @@ class SchemaValidationError extends UserError {
|
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
|
|
508
|
-
function cyrb53(str) {
|
|
509
|
-
const a = 2654435761;
|
|
510
|
-
const b = 1597334677;
|
|
511
|
-
const c = 2246822507;
|
|
512
|
-
const d = 3266489909;
|
|
513
|
-
const e = 4294967296;
|
|
514
|
-
const f = 2097151;
|
|
515
|
-
const seed = 0;
|
|
516
|
-
let h1 = 3735928559 ^ seed;
|
|
517
|
-
let h2 = 1103547991 ^ seed;
|
|
518
|
-
for (let i = 0, ch; i < str.length; i++) {
|
|
519
|
-
ch = str.charCodeAt(i);
|
|
520
|
-
h1 = Math.imul(h1 ^ ch, a);
|
|
521
|
-
h2 = Math.imul(h2 ^ ch, b);
|
|
522
|
-
}
|
|
523
|
-
h1 = Math.imul(h1 ^ h1 >>> 16, c) ^ Math.imul(h2 ^ h2 >>> 13, d);
|
|
524
|
-
h2 = Math.imul(h2 ^ h2 >>> 16, c) ^ Math.imul(h1 ^ h1 >>> 13, d);
|
|
525
|
-
return e * (f & h2) + (h1 >>> 0);
|
|
526
|
-
}
|
|
527
|
-
const computeHash = cyrb53;
|
|
528
|
-
|
|
529
508
|
const $schema$1 = "http://json-schema.org/draft-06/schema#";
|
|
530
509
|
const $id$1 = "https://html-validate.org/schemas/elements.json";
|
|
531
510
|
const type$1 = "object";
|
|
@@ -1001,6 +980,27 @@ const ajvFunctionKeyword = {
|
|
|
1001
980
|
validate: ajvFunctionValidate
|
|
1002
981
|
};
|
|
1003
982
|
|
|
983
|
+
function cyrb53(str) {
|
|
984
|
+
const a = 2654435761;
|
|
985
|
+
const b = 1597334677;
|
|
986
|
+
const c = 2246822507;
|
|
987
|
+
const d = 3266489909;
|
|
988
|
+
const e = 4294967296;
|
|
989
|
+
const f = 2097151;
|
|
990
|
+
const seed = 0;
|
|
991
|
+
let h1 = 3735928559 ^ seed;
|
|
992
|
+
let h2 = 1103547991 ^ seed;
|
|
993
|
+
for (let i = 0, ch; i < str.length; i++) {
|
|
994
|
+
ch = str.charCodeAt(i);
|
|
995
|
+
h1 = Math.imul(h1 ^ ch, a);
|
|
996
|
+
h2 = Math.imul(h2 ^ ch, b);
|
|
997
|
+
}
|
|
998
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, c) ^ Math.imul(h2 ^ h2 >>> 13, d);
|
|
999
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, c) ^ Math.imul(h1 ^ h1 >>> 13, d);
|
|
1000
|
+
return e * (f & h2) + (h1 >>> 0);
|
|
1001
|
+
}
|
|
1002
|
+
const computeHash = cyrb53;
|
|
1003
|
+
|
|
1004
1004
|
var TextContent$1 = /* @__PURE__ */ ((TextContent2) => {
|
|
1005
1005
|
TextContent2["NONE"] = "none";
|
|
1006
1006
|
TextContent2["DEFAULT"] = "default";
|
|
@@ -1601,7 +1601,6 @@ class DOMNode {
|
|
|
1601
1601
|
* @internal
|
|
1602
1602
|
*/
|
|
1603
1603
|
unique;
|
|
1604
|
-
/* eslint-disable-next-line sonarjs/use-type-alias -- technical debt */
|
|
1605
1604
|
cache;
|
|
1606
1605
|
/**
|
|
1607
1606
|
* Set of disabled rules for this node.
|
|
@@ -1641,8 +1640,8 @@ class DOMNode {
|
|
|
1641
1640
|
*
|
|
1642
1641
|
* @internal
|
|
1643
1642
|
*/
|
|
1644
|
-
cacheEnable() {
|
|
1645
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
1643
|
+
cacheEnable(enable = true) {
|
|
1644
|
+
this.cache = enable ? /* @__PURE__ */ new Map() : null;
|
|
1646
1645
|
}
|
|
1647
1646
|
cacheGet(key) {
|
|
1648
1647
|
if (this.cache) {
|
|
@@ -3329,172 +3328,6 @@ function parseQuantifier(quantifier) {
|
|
|
3329
3328
|
}
|
|
3330
3329
|
}
|
|
3331
3330
|
|
|
3332
|
-
const $schema = "http://json-schema.org/draft-06/schema#";
|
|
3333
|
-
const $id = "https://html-validate.org/schemas/config.json";
|
|
3334
|
-
const type = "object";
|
|
3335
|
-
const additionalProperties = false;
|
|
3336
|
-
const properties = {
|
|
3337
|
-
$schema: {
|
|
3338
|
-
type: "string"
|
|
3339
|
-
},
|
|
3340
|
-
root: {
|
|
3341
|
-
type: "boolean",
|
|
3342
|
-
title: "Mark as root configuration",
|
|
3343
|
-
description: "If this is set to true no further configurations will be searched.",
|
|
3344
|
-
"default": false
|
|
3345
|
-
},
|
|
3346
|
-
"extends": {
|
|
3347
|
-
type: "array",
|
|
3348
|
-
items: {
|
|
3349
|
-
type: "string"
|
|
3350
|
-
},
|
|
3351
|
-
title: "Configurations to extend",
|
|
3352
|
-
description: "Array of shareable or builtin configurations to extend."
|
|
3353
|
-
},
|
|
3354
|
-
elements: {
|
|
3355
|
-
type: "array",
|
|
3356
|
-
items: {
|
|
3357
|
-
anyOf: [
|
|
3358
|
-
{
|
|
3359
|
-
type: "string"
|
|
3360
|
-
},
|
|
3361
|
-
{
|
|
3362
|
-
type: "object"
|
|
3363
|
-
}
|
|
3364
|
-
]
|
|
3365
|
-
},
|
|
3366
|
-
title: "Element metadata to load",
|
|
3367
|
-
description: "Array of modules, plugins or files to load element metadata from. Use <rootDir> to refer to the folder with the package.json file.",
|
|
3368
|
-
examples: [
|
|
3369
|
-
[
|
|
3370
|
-
"html-validate:recommended",
|
|
3371
|
-
"plugin:recommended",
|
|
3372
|
-
"module",
|
|
3373
|
-
"./local-file.json"
|
|
3374
|
-
]
|
|
3375
|
-
]
|
|
3376
|
-
},
|
|
3377
|
-
plugins: {
|
|
3378
|
-
type: "array",
|
|
3379
|
-
items: {
|
|
3380
|
-
anyOf: [
|
|
3381
|
-
{
|
|
3382
|
-
type: "string"
|
|
3383
|
-
},
|
|
3384
|
-
{
|
|
3385
|
-
type: "object"
|
|
3386
|
-
}
|
|
3387
|
-
]
|
|
3388
|
-
},
|
|
3389
|
-
title: "Plugins to load",
|
|
3390
|
-
description: "Array of plugins load. Use <rootDir> to refer to the folder with the package.json file.",
|
|
3391
|
-
examples: [
|
|
3392
|
-
[
|
|
3393
|
-
"my-plugin",
|
|
3394
|
-
"./local-plugin"
|
|
3395
|
-
]
|
|
3396
|
-
]
|
|
3397
|
-
},
|
|
3398
|
-
transform: {
|
|
3399
|
-
type: "object",
|
|
3400
|
-
additionalProperties: {
|
|
3401
|
-
anyOf: [
|
|
3402
|
-
{
|
|
3403
|
-
type: "string"
|
|
3404
|
-
},
|
|
3405
|
-
{
|
|
3406
|
-
"function": true
|
|
3407
|
-
}
|
|
3408
|
-
]
|
|
3409
|
-
},
|
|
3410
|
-
title: "File transformations to use.",
|
|
3411
|
-
description: "Object where key is regular expression to match filename and value is name of transformer or a function.",
|
|
3412
|
-
examples: [
|
|
3413
|
-
{
|
|
3414
|
-
"^.*\\.foo$": "my-transformer",
|
|
3415
|
-
"^.*\\.bar$": "my-plugin",
|
|
3416
|
-
"^.*\\.baz$": "my-plugin:named"
|
|
3417
|
-
}
|
|
3418
|
-
]
|
|
3419
|
-
},
|
|
3420
|
-
rules: {
|
|
3421
|
-
type: "object",
|
|
3422
|
-
patternProperties: {
|
|
3423
|
-
".*": {
|
|
3424
|
-
anyOf: [
|
|
3425
|
-
{
|
|
3426
|
-
"enum": [
|
|
3427
|
-
0,
|
|
3428
|
-
1,
|
|
3429
|
-
2,
|
|
3430
|
-
"off",
|
|
3431
|
-
"warn",
|
|
3432
|
-
"error"
|
|
3433
|
-
]
|
|
3434
|
-
},
|
|
3435
|
-
{
|
|
3436
|
-
type: "array",
|
|
3437
|
-
minItems: 1,
|
|
3438
|
-
maxItems: 1,
|
|
3439
|
-
items: [
|
|
3440
|
-
{
|
|
3441
|
-
"enum": [
|
|
3442
|
-
0,
|
|
3443
|
-
1,
|
|
3444
|
-
2,
|
|
3445
|
-
"off",
|
|
3446
|
-
"warn",
|
|
3447
|
-
"error"
|
|
3448
|
-
]
|
|
3449
|
-
}
|
|
3450
|
-
]
|
|
3451
|
-
},
|
|
3452
|
-
{
|
|
3453
|
-
type: "array",
|
|
3454
|
-
minItems: 2,
|
|
3455
|
-
maxItems: 2,
|
|
3456
|
-
items: [
|
|
3457
|
-
{
|
|
3458
|
-
"enum": [
|
|
3459
|
-
0,
|
|
3460
|
-
1,
|
|
3461
|
-
2,
|
|
3462
|
-
"off",
|
|
3463
|
-
"warn",
|
|
3464
|
-
"error"
|
|
3465
|
-
]
|
|
3466
|
-
},
|
|
3467
|
-
{
|
|
3468
|
-
}
|
|
3469
|
-
]
|
|
3470
|
-
}
|
|
3471
|
-
]
|
|
3472
|
-
}
|
|
3473
|
-
},
|
|
3474
|
-
title: "Rule configuration.",
|
|
3475
|
-
description: "Enable/disable rules, set severity. Some rules have additional configuration like style or patterns to use.",
|
|
3476
|
-
examples: [
|
|
3477
|
-
{
|
|
3478
|
-
foo: "error",
|
|
3479
|
-
bar: "off",
|
|
3480
|
-
baz: [
|
|
3481
|
-
"error",
|
|
3482
|
-
{
|
|
3483
|
-
style: "camelcase"
|
|
3484
|
-
}
|
|
3485
|
-
]
|
|
3486
|
-
}
|
|
3487
|
-
]
|
|
3488
|
-
}
|
|
3489
|
-
};
|
|
3490
|
-
var configurationSchema = {
|
|
3491
|
-
$schema: $schema,
|
|
3492
|
-
$id: $id,
|
|
3493
|
-
type: type,
|
|
3494
|
-
additionalProperties: additionalProperties,
|
|
3495
|
-
properties: properties
|
|
3496
|
-
};
|
|
3497
|
-
|
|
3498
3331
|
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
3499
3332
|
Severity2[Severity2["DISABLED"] = 0] = "DISABLED";
|
|
3500
3333
|
Severity2[Severity2["WARN"] = 1] = "WARN";
|
|
@@ -3517,35 +3350,6 @@ function parseSeverity(value) {
|
|
|
3517
3350
|
}
|
|
3518
3351
|
}
|
|
3519
3352
|
|
|
3520
|
-
function escape(value) {
|
|
3521
|
-
return JSON.stringify(value);
|
|
3522
|
-
}
|
|
3523
|
-
function format(value, quote = false) {
|
|
3524
|
-
if (value === null || value === void 0) {
|
|
3525
|
-
return "null";
|
|
3526
|
-
}
|
|
3527
|
-
if (typeof value === "number") {
|
|
3528
|
-
return value.toString();
|
|
3529
|
-
}
|
|
3530
|
-
if (typeof value === "string") {
|
|
3531
|
-
return quote ? escape(value) : value;
|
|
3532
|
-
}
|
|
3533
|
-
if (Array.isArray(value)) {
|
|
3534
|
-
const content = value.map((it) => format(it, true)).join(", ");
|
|
3535
|
-
return `[ ${content} ]`;
|
|
3536
|
-
}
|
|
3537
|
-
if (typeof value === "object") {
|
|
3538
|
-
const content = Object.entries(value).map(([key, nested]) => `${key}: ${format(nested, true)}`).join(", ");
|
|
3539
|
-
return `{ ${content} }`;
|
|
3540
|
-
}
|
|
3541
|
-
return String(value);
|
|
3542
|
-
}
|
|
3543
|
-
function interpolate(text, data) {
|
|
3544
|
-
return text.replace(/{{\s*([^\s{}]+)\s*}}/g, (match, key) => {
|
|
3545
|
-
return typeof data[key] !== "undefined" ? format(data[key]) : match;
|
|
3546
|
-
});
|
|
3547
|
-
}
|
|
3548
|
-
|
|
3549
3353
|
const cacheKey = Symbol("aria-naming");
|
|
3550
3354
|
const defaultValue = "allowed";
|
|
3551
3355
|
const prohibitedRoles = [
|
|
@@ -3587,6 +3391,31 @@ function ariaNaming(element) {
|
|
|
3587
3391
|
return element.cacheSet(cacheKey, byMeta(element, meta));
|
|
3588
3392
|
}
|
|
3589
3393
|
|
|
3394
|
+
const INPUT_DISABLED_CACHE = Symbol(isInputDisabled.name);
|
|
3395
|
+
function isInputDisabled(node, details) {
|
|
3396
|
+
const cached = node.cacheGet(INPUT_DISABLED_CACHE);
|
|
3397
|
+
if (cached) {
|
|
3398
|
+
return details ? cached : cached.byFieldset || cached.bySelf;
|
|
3399
|
+
}
|
|
3400
|
+
const result = node.cacheSet(INPUT_DISABLED_CACHE, isInputDisabledImpl(node));
|
|
3401
|
+
return details ? result : result.byFieldset || result.bySelf;
|
|
3402
|
+
}
|
|
3403
|
+
function isInputDisabledImpl(node) {
|
|
3404
|
+
const hasDisabledAttr = (node2) => {
|
|
3405
|
+
const disabled = node2.getAttribute("disabled");
|
|
3406
|
+
return Boolean(disabled?.isStatic);
|
|
3407
|
+
};
|
|
3408
|
+
const hasDisabledFieldset = (node2) => {
|
|
3409
|
+
const fieldset = node2.closest("fieldset[disabled]");
|
|
3410
|
+
const disabled = fieldset?.getAttribute("disabled");
|
|
3411
|
+
return Boolean(disabled?.isStatic);
|
|
3412
|
+
};
|
|
3413
|
+
return {
|
|
3414
|
+
byFieldset: hasDisabledFieldset(node),
|
|
3415
|
+
bySelf: hasDisabledAttr(node)
|
|
3416
|
+
};
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3590
3419
|
const patternCache = /* @__PURE__ */ new Map();
|
|
3591
3420
|
function compileStringPattern(pattern) {
|
|
3592
3421
|
const regexp = pattern.replace(/[*]+/g, ".+");
|
|
@@ -3840,6 +3669,35 @@ function partition(values, predicate) {
|
|
|
3840
3669
|
}, initial);
|
|
3841
3670
|
}
|
|
3842
3671
|
|
|
3672
|
+
function escape(value) {
|
|
3673
|
+
return JSON.stringify(value);
|
|
3674
|
+
}
|
|
3675
|
+
function format(value, quote = false) {
|
|
3676
|
+
if (value === null || value === void 0) {
|
|
3677
|
+
return "null";
|
|
3678
|
+
}
|
|
3679
|
+
if (typeof value === "number") {
|
|
3680
|
+
return value.toString();
|
|
3681
|
+
}
|
|
3682
|
+
if (typeof value === "string") {
|
|
3683
|
+
return quote ? escape(value) : value;
|
|
3684
|
+
}
|
|
3685
|
+
if (Array.isArray(value)) {
|
|
3686
|
+
const content = value.map((it) => format(it, true)).join(", ");
|
|
3687
|
+
return `[ ${content} ]`;
|
|
3688
|
+
}
|
|
3689
|
+
if (typeof value === "object") {
|
|
3690
|
+
const content = Object.entries(value).map(([key, nested]) => `${key}: ${format(nested, true)}`).join(", ");
|
|
3691
|
+
return `{ ${content} }`;
|
|
3692
|
+
}
|
|
3693
|
+
return String(value);
|
|
3694
|
+
}
|
|
3695
|
+
function interpolate(text, data) {
|
|
3696
|
+
return text.replace(/{{\s*([^\s{}]+)\s*}}/g, (match, key) => {
|
|
3697
|
+
return typeof data[key] !== "undefined" ? format(data[key]) : match;
|
|
3698
|
+
});
|
|
3699
|
+
}
|
|
3700
|
+
|
|
3843
3701
|
const ajv$1 = new Ajv__default.default({ strict: true, strictTuples: true, strictTypes: true });
|
|
3844
3702
|
ajv$1.addMetaSchema(ajvSchemaDraft);
|
|
3845
3703
|
function getSchemaValidator(ruleId, properties) {
|
|
@@ -6528,6 +6386,18 @@ const defaults$l = {
|
|
|
6528
6386
|
};
|
|
6529
6387
|
const UNIQUE_CACHE_KEY = Symbol("form-elements-unique");
|
|
6530
6388
|
const SHARED_CACHE_KEY = Symbol("form-elements-shared");
|
|
6389
|
+
function isEnabled(element) {
|
|
6390
|
+
if (isHTMLHidden(element)) {
|
|
6391
|
+
return false;
|
|
6392
|
+
}
|
|
6393
|
+
if (isInert(element)) {
|
|
6394
|
+
return false;
|
|
6395
|
+
}
|
|
6396
|
+
if (isInputDisabled(element)) {
|
|
6397
|
+
return false;
|
|
6398
|
+
}
|
|
6399
|
+
return true;
|
|
6400
|
+
}
|
|
6531
6401
|
function haveName(name) {
|
|
6532
6402
|
return typeof name === "string" && name !== "";
|
|
6533
6403
|
}
|
|
@@ -6598,7 +6468,7 @@ class FormDupName extends Rule {
|
|
|
6598
6468
|
const { shared } = this.options;
|
|
6599
6469
|
this.on("dom:ready", (event) => {
|
|
6600
6470
|
const { document } = event;
|
|
6601
|
-
const controls = document.querySelectorAll(selector);
|
|
6471
|
+
const controls = document.querySelectorAll(selector).filter(isEnabled);
|
|
6602
6472
|
const [sharedControls, uniqueControls] = partition(controls, (it) => {
|
|
6603
6473
|
return allowSharedName(it, shared);
|
|
6604
6474
|
});
|
|
@@ -7354,69 +7224,6 @@ class LongTitle extends Rule {
|
|
|
7354
7224
|
}
|
|
7355
7225
|
}
|
|
7356
7226
|
|
|
7357
|
-
const defaults$h = {
|
|
7358
|
-
allowLongDelay: false
|
|
7359
|
-
};
|
|
7360
|
-
class MetaRefresh extends Rule {
|
|
7361
|
-
constructor(options) {
|
|
7362
|
-
super({ ...defaults$h, ...options });
|
|
7363
|
-
}
|
|
7364
|
-
documentation() {
|
|
7365
|
-
return {
|
|
7366
|
-
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.`,
|
|
7367
|
-
url: "https://html-validate.org/rules/meta-refresh.html"
|
|
7368
|
-
};
|
|
7369
|
-
}
|
|
7370
|
-
setup() {
|
|
7371
|
-
this.on("element:ready", ({ target }) => {
|
|
7372
|
-
if (!target.is("meta")) {
|
|
7373
|
-
return;
|
|
7374
|
-
}
|
|
7375
|
-
const httpEquiv = target.getAttributeValue("http-equiv");
|
|
7376
|
-
if (httpEquiv !== "refresh") {
|
|
7377
|
-
return;
|
|
7378
|
-
}
|
|
7379
|
-
const content = target.getAttribute("content");
|
|
7380
|
-
if (!content?.value || content.isDynamic) {
|
|
7381
|
-
return;
|
|
7382
|
-
}
|
|
7383
|
-
const location = content.valueLocation;
|
|
7384
|
-
const value = parseContent(content.value.toString());
|
|
7385
|
-
if (!value) {
|
|
7386
|
-
this.report(target, "Malformed meta refresh directive", location);
|
|
7387
|
-
return;
|
|
7388
|
-
}
|
|
7389
|
-
const { delay, url } = value;
|
|
7390
|
-
this.validateDelay(target, location, delay, url);
|
|
7391
|
-
});
|
|
7392
|
-
}
|
|
7393
|
-
validateDelay(target, location, delay, url) {
|
|
7394
|
-
const { allowLongDelay } = this.options;
|
|
7395
|
-
if (allowLongDelay && delay > 72e3) {
|
|
7396
|
-
return;
|
|
7397
|
-
}
|
|
7398
|
-
if (!url && delay === 0) {
|
|
7399
|
-
this.report(target, "Don't use instant meta refresh to reload the page", location);
|
|
7400
|
-
return;
|
|
7401
|
-
}
|
|
7402
|
-
if (delay !== 0) {
|
|
7403
|
-
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)";
|
|
7404
|
-
this.report(target, message, location);
|
|
7405
|
-
}
|
|
7406
|
-
}
|
|
7407
|
-
}
|
|
7408
|
-
function parseContent(text) {
|
|
7409
|
-
const match = /^(\d+)(?:\s*;\s*url=(.*))?/i.exec(text);
|
|
7410
|
-
if (match) {
|
|
7411
|
-
return {
|
|
7412
|
-
delay: parseInt(match[1], 10),
|
|
7413
|
-
url: match[2]
|
|
7414
|
-
};
|
|
7415
|
-
} else {
|
|
7416
|
-
return null;
|
|
7417
|
-
}
|
|
7418
|
-
}
|
|
7419
|
-
|
|
7420
7227
|
function getName(attr) {
|
|
7421
7228
|
const name = attr.value;
|
|
7422
7229
|
if (!name || name instanceof DynamicValue) {
|
|
@@ -7479,16 +7286,79 @@ class MapIdName extends Rule {
|
|
|
7479
7286
|
if (!hasStaticValue(id) || !hasStaticValue(name)) {
|
|
7480
7287
|
return;
|
|
7481
7288
|
}
|
|
7482
|
-
if (id.value === name.value) {
|
|
7289
|
+
if (id.value === name.value) {
|
|
7290
|
+
return;
|
|
7291
|
+
}
|
|
7292
|
+
this.report({
|
|
7293
|
+
node: event.target,
|
|
7294
|
+
message: `"id" and "name" attribute must be the same on <map> elements`,
|
|
7295
|
+
location: id.valueLocation ?? name.valueLocation
|
|
7296
|
+
});
|
|
7297
|
+
});
|
|
7298
|
+
}
|
|
7299
|
+
}
|
|
7300
|
+
|
|
7301
|
+
const defaults$h = {
|
|
7302
|
+
allowLongDelay: false
|
|
7303
|
+
};
|
|
7304
|
+
class MetaRefresh extends Rule {
|
|
7305
|
+
constructor(options) {
|
|
7306
|
+
super({ ...defaults$h, ...options });
|
|
7307
|
+
}
|
|
7308
|
+
documentation() {
|
|
7309
|
+
return {
|
|
7310
|
+
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.`,
|
|
7311
|
+
url: "https://html-validate.org/rules/meta-refresh.html"
|
|
7312
|
+
};
|
|
7313
|
+
}
|
|
7314
|
+
setup() {
|
|
7315
|
+
this.on("element:ready", ({ target }) => {
|
|
7316
|
+
if (!target.is("meta")) {
|
|
7317
|
+
return;
|
|
7318
|
+
}
|
|
7319
|
+
const httpEquiv = target.getAttributeValue("http-equiv");
|
|
7320
|
+
if (httpEquiv !== "refresh") {
|
|
7321
|
+
return;
|
|
7322
|
+
}
|
|
7323
|
+
const content = target.getAttribute("content");
|
|
7324
|
+
if (!content?.value || content.isDynamic) {
|
|
7483
7325
|
return;
|
|
7484
7326
|
}
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7327
|
+
const location = content.valueLocation;
|
|
7328
|
+
const value = parseContent(content.value.toString());
|
|
7329
|
+
if (!value) {
|
|
7330
|
+
this.report(target, "Malformed meta refresh directive", location);
|
|
7331
|
+
return;
|
|
7332
|
+
}
|
|
7333
|
+
const { delay, url } = value;
|
|
7334
|
+
this.validateDelay(target, location, delay, url);
|
|
7490
7335
|
});
|
|
7491
7336
|
}
|
|
7337
|
+
validateDelay(target, location, delay, url) {
|
|
7338
|
+
const { allowLongDelay } = this.options;
|
|
7339
|
+
if (allowLongDelay && delay > 72e3) {
|
|
7340
|
+
return;
|
|
7341
|
+
}
|
|
7342
|
+
if (!url && delay === 0) {
|
|
7343
|
+
this.report(target, "Don't use instant meta refresh to reload the page", location);
|
|
7344
|
+
return;
|
|
7345
|
+
}
|
|
7346
|
+
if (delay !== 0) {
|
|
7347
|
+
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)";
|
|
7348
|
+
this.report(target, message, location);
|
|
7349
|
+
}
|
|
7350
|
+
}
|
|
7351
|
+
}
|
|
7352
|
+
function parseContent(text) {
|
|
7353
|
+
const match = /^(\d+)(?:\s*;\s*url=(.*))?/i.exec(text);
|
|
7354
|
+
if (match) {
|
|
7355
|
+
return {
|
|
7356
|
+
delay: parseInt(match[1], 10),
|
|
7357
|
+
url: match[2]
|
|
7358
|
+
};
|
|
7359
|
+
} else {
|
|
7360
|
+
return null;
|
|
7361
|
+
}
|
|
7492
7362
|
}
|
|
7493
7363
|
|
|
7494
7364
|
class MissingDoctype extends Rule {
|
|
@@ -7887,30 +7757,6 @@ class NoImplicitButtonType extends Rule {
|
|
|
7887
7757
|
}
|
|
7888
7758
|
}
|
|
7889
7759
|
|
|
7890
|
-
function isRelevant$1(event) {
|
|
7891
|
-
return event.target.is("input");
|
|
7892
|
-
}
|
|
7893
|
-
class NoImplicitInputType extends Rule {
|
|
7894
|
-
documentation() {
|
|
7895
|
-
return {
|
|
7896
|
-
description: ["`<input>` is missing recommended `type` attribute"].join("\n"),
|
|
7897
|
-
url: "https://html-validate.org/rules/no-implicit-input-type.html"
|
|
7898
|
-
};
|
|
7899
|
-
}
|
|
7900
|
-
setup() {
|
|
7901
|
-
this.on("element:ready", isRelevant$1, (event) => {
|
|
7902
|
-
const { target } = event;
|
|
7903
|
-
const attr = target.getAttribute("type");
|
|
7904
|
-
if (!attr) {
|
|
7905
|
-
this.report({
|
|
7906
|
-
node: event.target,
|
|
7907
|
-
message: `<input> is missing recommended "type" attribute`
|
|
7908
|
-
});
|
|
7909
|
-
}
|
|
7910
|
-
});
|
|
7911
|
-
}
|
|
7912
|
-
}
|
|
7913
|
-
|
|
7914
7760
|
class NoImplicitClose extends Rule {
|
|
7915
7761
|
documentation() {
|
|
7916
7762
|
return {
|
|
@@ -7963,6 +7809,30 @@ Omitted end tags can be ambigious for humans to read and many editors have troub
|
|
|
7963
7809
|
}
|
|
7964
7810
|
}
|
|
7965
7811
|
|
|
7812
|
+
function isRelevant$1(event) {
|
|
7813
|
+
return event.target.is("input");
|
|
7814
|
+
}
|
|
7815
|
+
class NoImplicitInputType extends Rule {
|
|
7816
|
+
documentation() {
|
|
7817
|
+
return {
|
|
7818
|
+
description: ["`<input>` is missing recommended `type` attribute"].join("\n"),
|
|
7819
|
+
url: "https://html-validate.org/rules/no-implicit-input-type.html"
|
|
7820
|
+
};
|
|
7821
|
+
}
|
|
7822
|
+
setup() {
|
|
7823
|
+
this.on("element:ready", isRelevant$1, (event) => {
|
|
7824
|
+
const { target } = event;
|
|
7825
|
+
const attr = target.getAttribute("type");
|
|
7826
|
+
if (!attr) {
|
|
7827
|
+
this.report({
|
|
7828
|
+
node: event.target,
|
|
7829
|
+
message: `<input> is missing recommended "type" attribute`
|
|
7830
|
+
});
|
|
7831
|
+
}
|
|
7832
|
+
});
|
|
7833
|
+
}
|
|
7834
|
+
}
|
|
7835
|
+
|
|
7966
7836
|
const defaults$e = {
|
|
7967
7837
|
include: null,
|
|
7968
7838
|
exclude: null,
|
|
@@ -10716,6 +10586,172 @@ const bundledRules = {
|
|
|
10716
10586
|
...bundledRules$1
|
|
10717
10587
|
};
|
|
10718
10588
|
|
|
10589
|
+
const $schema = "http://json-schema.org/draft-06/schema#";
|
|
10590
|
+
const $id = "https://html-validate.org/schemas/config.json";
|
|
10591
|
+
const type = "object";
|
|
10592
|
+
const additionalProperties = false;
|
|
10593
|
+
const properties = {
|
|
10594
|
+
$schema: {
|
|
10595
|
+
type: "string"
|
|
10596
|
+
},
|
|
10597
|
+
root: {
|
|
10598
|
+
type: "boolean",
|
|
10599
|
+
title: "Mark as root configuration",
|
|
10600
|
+
description: "If this is set to true no further configurations will be searched.",
|
|
10601
|
+
"default": false
|
|
10602
|
+
},
|
|
10603
|
+
"extends": {
|
|
10604
|
+
type: "array",
|
|
10605
|
+
items: {
|
|
10606
|
+
type: "string"
|
|
10607
|
+
},
|
|
10608
|
+
title: "Configurations to extend",
|
|
10609
|
+
description: "Array of shareable or builtin configurations to extend."
|
|
10610
|
+
},
|
|
10611
|
+
elements: {
|
|
10612
|
+
type: "array",
|
|
10613
|
+
items: {
|
|
10614
|
+
anyOf: [
|
|
10615
|
+
{
|
|
10616
|
+
type: "string"
|
|
10617
|
+
},
|
|
10618
|
+
{
|
|
10619
|
+
type: "object"
|
|
10620
|
+
}
|
|
10621
|
+
]
|
|
10622
|
+
},
|
|
10623
|
+
title: "Element metadata to load",
|
|
10624
|
+
description: "Array of modules, plugins or files to load element metadata from. Use <rootDir> to refer to the folder with the package.json file.",
|
|
10625
|
+
examples: [
|
|
10626
|
+
[
|
|
10627
|
+
"html-validate:recommended",
|
|
10628
|
+
"plugin:recommended",
|
|
10629
|
+
"module",
|
|
10630
|
+
"./local-file.json"
|
|
10631
|
+
]
|
|
10632
|
+
]
|
|
10633
|
+
},
|
|
10634
|
+
plugins: {
|
|
10635
|
+
type: "array",
|
|
10636
|
+
items: {
|
|
10637
|
+
anyOf: [
|
|
10638
|
+
{
|
|
10639
|
+
type: "string"
|
|
10640
|
+
},
|
|
10641
|
+
{
|
|
10642
|
+
type: "object"
|
|
10643
|
+
}
|
|
10644
|
+
]
|
|
10645
|
+
},
|
|
10646
|
+
title: "Plugins to load",
|
|
10647
|
+
description: "Array of plugins load. Use <rootDir> to refer to the folder with the package.json file.",
|
|
10648
|
+
examples: [
|
|
10649
|
+
[
|
|
10650
|
+
"my-plugin",
|
|
10651
|
+
"./local-plugin"
|
|
10652
|
+
]
|
|
10653
|
+
]
|
|
10654
|
+
},
|
|
10655
|
+
transform: {
|
|
10656
|
+
type: "object",
|
|
10657
|
+
additionalProperties: {
|
|
10658
|
+
anyOf: [
|
|
10659
|
+
{
|
|
10660
|
+
type: "string"
|
|
10661
|
+
},
|
|
10662
|
+
{
|
|
10663
|
+
"function": true
|
|
10664
|
+
}
|
|
10665
|
+
]
|
|
10666
|
+
},
|
|
10667
|
+
title: "File transformations to use.",
|
|
10668
|
+
description: "Object where key is regular expression to match filename and value is name of transformer or a function.",
|
|
10669
|
+
examples: [
|
|
10670
|
+
{
|
|
10671
|
+
"^.*\\.foo$": "my-transformer",
|
|
10672
|
+
"^.*\\.bar$": "my-plugin",
|
|
10673
|
+
"^.*\\.baz$": "my-plugin:named"
|
|
10674
|
+
}
|
|
10675
|
+
]
|
|
10676
|
+
},
|
|
10677
|
+
rules: {
|
|
10678
|
+
type: "object",
|
|
10679
|
+
patternProperties: {
|
|
10680
|
+
".*": {
|
|
10681
|
+
anyOf: [
|
|
10682
|
+
{
|
|
10683
|
+
"enum": [
|
|
10684
|
+
0,
|
|
10685
|
+
1,
|
|
10686
|
+
2,
|
|
10687
|
+
"off",
|
|
10688
|
+
"warn",
|
|
10689
|
+
"error"
|
|
10690
|
+
]
|
|
10691
|
+
},
|
|
10692
|
+
{
|
|
10693
|
+
type: "array",
|
|
10694
|
+
minItems: 1,
|
|
10695
|
+
maxItems: 1,
|
|
10696
|
+
items: [
|
|
10697
|
+
{
|
|
10698
|
+
"enum": [
|
|
10699
|
+
0,
|
|
10700
|
+
1,
|
|
10701
|
+
2,
|
|
10702
|
+
"off",
|
|
10703
|
+
"warn",
|
|
10704
|
+
"error"
|
|
10705
|
+
]
|
|
10706
|
+
}
|
|
10707
|
+
]
|
|
10708
|
+
},
|
|
10709
|
+
{
|
|
10710
|
+
type: "array",
|
|
10711
|
+
minItems: 2,
|
|
10712
|
+
maxItems: 2,
|
|
10713
|
+
items: [
|
|
10714
|
+
{
|
|
10715
|
+
"enum": [
|
|
10716
|
+
0,
|
|
10717
|
+
1,
|
|
10718
|
+
2,
|
|
10719
|
+
"off",
|
|
10720
|
+
"warn",
|
|
10721
|
+
"error"
|
|
10722
|
+
]
|
|
10723
|
+
},
|
|
10724
|
+
{
|
|
10725
|
+
}
|
|
10726
|
+
]
|
|
10727
|
+
}
|
|
10728
|
+
]
|
|
10729
|
+
}
|
|
10730
|
+
},
|
|
10731
|
+
title: "Rule configuration.",
|
|
10732
|
+
description: "Enable/disable rules, set severity. Some rules have additional configuration like style or patterns to use.",
|
|
10733
|
+
examples: [
|
|
10734
|
+
{
|
|
10735
|
+
foo: "error",
|
|
10736
|
+
bar: "off",
|
|
10737
|
+
baz: [
|
|
10738
|
+
"error",
|
|
10739
|
+
{
|
|
10740
|
+
style: "camelcase"
|
|
10741
|
+
}
|
|
10742
|
+
]
|
|
10743
|
+
}
|
|
10744
|
+
]
|
|
10745
|
+
}
|
|
10746
|
+
};
|
|
10747
|
+
var configurationSchema = {
|
|
10748
|
+
$schema: $schema,
|
|
10749
|
+
$id: $id,
|
|
10750
|
+
type: type,
|
|
10751
|
+
additionalProperties: additionalProperties,
|
|
10752
|
+
properties: properties
|
|
10753
|
+
};
|
|
10754
|
+
|
|
10719
10755
|
function dumpTree(root) {
|
|
10720
10756
|
const lines = [];
|
|
10721
10757
|
function decoration(node) {
|
|
@@ -11851,7 +11887,7 @@ class EventHandler {
|
|
|
11851
11887
|
}
|
|
11852
11888
|
|
|
11853
11889
|
const name = "html-validate";
|
|
11854
|
-
const version = "10.1.
|
|
11890
|
+
const version = "10.1.2";
|
|
11855
11891
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
11856
11892
|
|
|
11857
11893
|
function freeze(src) {
|