html-validate 10.1.0 → 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 +370 -315
- 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 +371 -316
- 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/dist/types/browser.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- 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) {
|
|
@@ -2752,6 +2751,22 @@ class HtmlElement extends DOMNode {
|
|
|
2752
2751
|
}
|
|
2753
2752
|
return this.cacheSet(TABINDEX, parsed);
|
|
2754
2753
|
}
|
|
2754
|
+
/**
|
|
2755
|
+
* Read-only property with the type of the text content of this
|
|
2756
|
+
* element.
|
|
2757
|
+
*
|
|
2758
|
+
* @internal
|
|
2759
|
+
*/
|
|
2760
|
+
get textType() {
|
|
2761
|
+
const tagName = this.tagName.toLowerCase();
|
|
2762
|
+
if (tagName === "script") {
|
|
2763
|
+
return "script";
|
|
2764
|
+
} else if (tagName === "style") {
|
|
2765
|
+
return "css";
|
|
2766
|
+
} else {
|
|
2767
|
+
return "text";
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2755
2770
|
/**
|
|
2756
2771
|
* Get a list of all attributes on this node.
|
|
2757
2772
|
*/
|
|
@@ -3304,172 +3319,6 @@ function parseQuantifier(quantifier) {
|
|
|
3304
3319
|
}
|
|
3305
3320
|
}
|
|
3306
3321
|
|
|
3307
|
-
const $schema = "http://json-schema.org/draft-06/schema#";
|
|
3308
|
-
const $id = "https://html-validate.org/schemas/config.json";
|
|
3309
|
-
const type = "object";
|
|
3310
|
-
const additionalProperties = false;
|
|
3311
|
-
const properties = {
|
|
3312
|
-
$schema: {
|
|
3313
|
-
type: "string"
|
|
3314
|
-
},
|
|
3315
|
-
root: {
|
|
3316
|
-
type: "boolean",
|
|
3317
|
-
title: "Mark as root configuration",
|
|
3318
|
-
description: "If this is set to true no further configurations will be searched.",
|
|
3319
|
-
"default": false
|
|
3320
|
-
},
|
|
3321
|
-
"extends": {
|
|
3322
|
-
type: "array",
|
|
3323
|
-
items: {
|
|
3324
|
-
type: "string"
|
|
3325
|
-
},
|
|
3326
|
-
title: "Configurations to extend",
|
|
3327
|
-
description: "Array of shareable or builtin configurations to extend."
|
|
3328
|
-
},
|
|
3329
|
-
elements: {
|
|
3330
|
-
type: "array",
|
|
3331
|
-
items: {
|
|
3332
|
-
anyOf: [
|
|
3333
|
-
{
|
|
3334
|
-
type: "string"
|
|
3335
|
-
},
|
|
3336
|
-
{
|
|
3337
|
-
type: "object"
|
|
3338
|
-
}
|
|
3339
|
-
]
|
|
3340
|
-
},
|
|
3341
|
-
title: "Element metadata to load",
|
|
3342
|
-
description: "Array of modules, plugins or files to load element metadata from. Use <rootDir> to refer to the folder with the package.json file.",
|
|
3343
|
-
examples: [
|
|
3344
|
-
[
|
|
3345
|
-
"html-validate:recommended",
|
|
3346
|
-
"plugin:recommended",
|
|
3347
|
-
"module",
|
|
3348
|
-
"./local-file.json"
|
|
3349
|
-
]
|
|
3350
|
-
]
|
|
3351
|
-
},
|
|
3352
|
-
plugins: {
|
|
3353
|
-
type: "array",
|
|
3354
|
-
items: {
|
|
3355
|
-
anyOf: [
|
|
3356
|
-
{
|
|
3357
|
-
type: "string"
|
|
3358
|
-
},
|
|
3359
|
-
{
|
|
3360
|
-
type: "object"
|
|
3361
|
-
}
|
|
3362
|
-
]
|
|
3363
|
-
},
|
|
3364
|
-
title: "Plugins to load",
|
|
3365
|
-
description: "Array of plugins load. Use <rootDir> to refer to the folder with the package.json file.",
|
|
3366
|
-
examples: [
|
|
3367
|
-
[
|
|
3368
|
-
"my-plugin",
|
|
3369
|
-
"./local-plugin"
|
|
3370
|
-
]
|
|
3371
|
-
]
|
|
3372
|
-
},
|
|
3373
|
-
transform: {
|
|
3374
|
-
type: "object",
|
|
3375
|
-
additionalProperties: {
|
|
3376
|
-
anyOf: [
|
|
3377
|
-
{
|
|
3378
|
-
type: "string"
|
|
3379
|
-
},
|
|
3380
|
-
{
|
|
3381
|
-
"function": true
|
|
3382
|
-
}
|
|
3383
|
-
]
|
|
3384
|
-
},
|
|
3385
|
-
title: "File transformations to use.",
|
|
3386
|
-
description: "Object where key is regular expression to match filename and value is name of transformer or a function.",
|
|
3387
|
-
examples: [
|
|
3388
|
-
{
|
|
3389
|
-
"^.*\\.foo$": "my-transformer",
|
|
3390
|
-
"^.*\\.bar$": "my-plugin",
|
|
3391
|
-
"^.*\\.baz$": "my-plugin:named"
|
|
3392
|
-
}
|
|
3393
|
-
]
|
|
3394
|
-
},
|
|
3395
|
-
rules: {
|
|
3396
|
-
type: "object",
|
|
3397
|
-
patternProperties: {
|
|
3398
|
-
".*": {
|
|
3399
|
-
anyOf: [
|
|
3400
|
-
{
|
|
3401
|
-
"enum": [
|
|
3402
|
-
0,
|
|
3403
|
-
1,
|
|
3404
|
-
2,
|
|
3405
|
-
"off",
|
|
3406
|
-
"warn",
|
|
3407
|
-
"error"
|
|
3408
|
-
]
|
|
3409
|
-
},
|
|
3410
|
-
{
|
|
3411
|
-
type: "array",
|
|
3412
|
-
minItems: 1,
|
|
3413
|
-
maxItems: 1,
|
|
3414
|
-
items: [
|
|
3415
|
-
{
|
|
3416
|
-
"enum": [
|
|
3417
|
-
0,
|
|
3418
|
-
1,
|
|
3419
|
-
2,
|
|
3420
|
-
"off",
|
|
3421
|
-
"warn",
|
|
3422
|
-
"error"
|
|
3423
|
-
]
|
|
3424
|
-
}
|
|
3425
|
-
]
|
|
3426
|
-
},
|
|
3427
|
-
{
|
|
3428
|
-
type: "array",
|
|
3429
|
-
minItems: 2,
|
|
3430
|
-
maxItems: 2,
|
|
3431
|
-
items: [
|
|
3432
|
-
{
|
|
3433
|
-
"enum": [
|
|
3434
|
-
0,
|
|
3435
|
-
1,
|
|
3436
|
-
2,
|
|
3437
|
-
"off",
|
|
3438
|
-
"warn",
|
|
3439
|
-
"error"
|
|
3440
|
-
]
|
|
3441
|
-
},
|
|
3442
|
-
{
|
|
3443
|
-
}
|
|
3444
|
-
]
|
|
3445
|
-
}
|
|
3446
|
-
]
|
|
3447
|
-
}
|
|
3448
|
-
},
|
|
3449
|
-
title: "Rule configuration.",
|
|
3450
|
-
description: "Enable/disable rules, set severity. Some rules have additional configuration like style or patterns to use.",
|
|
3451
|
-
examples: [
|
|
3452
|
-
{
|
|
3453
|
-
foo: "error",
|
|
3454
|
-
bar: "off",
|
|
3455
|
-
baz: [
|
|
3456
|
-
"error",
|
|
3457
|
-
{
|
|
3458
|
-
style: "camelcase"
|
|
3459
|
-
}
|
|
3460
|
-
]
|
|
3461
|
-
}
|
|
3462
|
-
]
|
|
3463
|
-
}
|
|
3464
|
-
};
|
|
3465
|
-
var configurationSchema = {
|
|
3466
|
-
$schema: $schema,
|
|
3467
|
-
$id: $id,
|
|
3468
|
-
type: type,
|
|
3469
|
-
additionalProperties: additionalProperties,
|
|
3470
|
-
properties: properties
|
|
3471
|
-
};
|
|
3472
|
-
|
|
3473
3322
|
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
3474
3323
|
Severity2[Severity2["DISABLED"] = 0] = "DISABLED";
|
|
3475
3324
|
Severity2[Severity2["WARN"] = 1] = "WARN";
|
|
@@ -3492,35 +3341,6 @@ function parseSeverity(value) {
|
|
|
3492
3341
|
}
|
|
3493
3342
|
}
|
|
3494
3343
|
|
|
3495
|
-
function escape(value) {
|
|
3496
|
-
return JSON.stringify(value);
|
|
3497
|
-
}
|
|
3498
|
-
function format(value, quote = false) {
|
|
3499
|
-
if (value === null || value === void 0) {
|
|
3500
|
-
return "null";
|
|
3501
|
-
}
|
|
3502
|
-
if (typeof value === "number") {
|
|
3503
|
-
return value.toString();
|
|
3504
|
-
}
|
|
3505
|
-
if (typeof value === "string") {
|
|
3506
|
-
return quote ? escape(value) : value;
|
|
3507
|
-
}
|
|
3508
|
-
if (Array.isArray(value)) {
|
|
3509
|
-
const content = value.map((it) => format(it, true)).join(", ");
|
|
3510
|
-
return `[ ${content} ]`;
|
|
3511
|
-
}
|
|
3512
|
-
if (typeof value === "object") {
|
|
3513
|
-
const content = Object.entries(value).map(([key, nested]) => `${key}: ${format(nested, true)}`).join(", ");
|
|
3514
|
-
return `{ ${content} }`;
|
|
3515
|
-
}
|
|
3516
|
-
return String(value);
|
|
3517
|
-
}
|
|
3518
|
-
function interpolate(text, data) {
|
|
3519
|
-
return text.replace(/{{\s*([^\s{}]+)\s*}}/g, (match, key) => {
|
|
3520
|
-
return typeof data[key] !== "undefined" ? format(data[key]) : match;
|
|
3521
|
-
});
|
|
3522
|
-
}
|
|
3523
|
-
|
|
3524
3344
|
const cacheKey = Symbol("aria-naming");
|
|
3525
3345
|
const defaultValue = "allowed";
|
|
3526
3346
|
const prohibitedRoles = [
|
|
@@ -3562,6 +3382,31 @@ function ariaNaming(element) {
|
|
|
3562
3382
|
return element.cacheSet(cacheKey, byMeta(element, meta));
|
|
3563
3383
|
}
|
|
3564
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
|
+
|
|
3565
3410
|
const patternCache = /* @__PURE__ */ new Map();
|
|
3566
3411
|
function compileStringPattern(pattern) {
|
|
3567
3412
|
const regexp = pattern.replace(/[*]+/g, ".+");
|
|
@@ -3815,6 +3660,35 @@ function partition(values, predicate) {
|
|
|
3815
3660
|
}, initial);
|
|
3816
3661
|
}
|
|
3817
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
|
+
|
|
3818
3692
|
const ajv$1 = new Ajv({ strict: true, strictTuples: true, strictTypes: true });
|
|
3819
3693
|
ajv$1.addMetaSchema(ajvSchemaDraft);
|
|
3820
3694
|
function getSchemaValidator(ruleId, properties) {
|
|
@@ -6503,6 +6377,18 @@ const defaults$l = {
|
|
|
6503
6377
|
};
|
|
6504
6378
|
const UNIQUE_CACHE_KEY = Symbol("form-elements-unique");
|
|
6505
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
|
+
}
|
|
6506
6392
|
function haveName(name) {
|
|
6507
6393
|
return typeof name === "string" && name !== "";
|
|
6508
6394
|
}
|
|
@@ -6573,7 +6459,7 @@ class FormDupName extends Rule {
|
|
|
6573
6459
|
const { shared } = this.options;
|
|
6574
6460
|
this.on("dom:ready", (event) => {
|
|
6575
6461
|
const { document } = event;
|
|
6576
|
-
const controls = document.querySelectorAll(selector);
|
|
6462
|
+
const controls = document.querySelectorAll(selector).filter(isEnabled);
|
|
6577
6463
|
const [sharedControls, uniqueControls] = partition(controls, (it) => {
|
|
6578
6464
|
return allowSharedName(it, shared);
|
|
6579
6465
|
});
|
|
@@ -7329,69 +7215,6 @@ class LongTitle extends Rule {
|
|
|
7329
7215
|
}
|
|
7330
7216
|
}
|
|
7331
7217
|
|
|
7332
|
-
const defaults$h = {
|
|
7333
|
-
allowLongDelay: false
|
|
7334
|
-
};
|
|
7335
|
-
class MetaRefresh extends Rule {
|
|
7336
|
-
constructor(options) {
|
|
7337
|
-
super({ ...defaults$h, ...options });
|
|
7338
|
-
}
|
|
7339
|
-
documentation() {
|
|
7340
|
-
return {
|
|
7341
|
-
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.`,
|
|
7342
|
-
url: "https://html-validate.org/rules/meta-refresh.html"
|
|
7343
|
-
};
|
|
7344
|
-
}
|
|
7345
|
-
setup() {
|
|
7346
|
-
this.on("element:ready", ({ target }) => {
|
|
7347
|
-
if (!target.is("meta")) {
|
|
7348
|
-
return;
|
|
7349
|
-
}
|
|
7350
|
-
const httpEquiv = target.getAttributeValue("http-equiv");
|
|
7351
|
-
if (httpEquiv !== "refresh") {
|
|
7352
|
-
return;
|
|
7353
|
-
}
|
|
7354
|
-
const content = target.getAttribute("content");
|
|
7355
|
-
if (!content?.value || content.isDynamic) {
|
|
7356
|
-
return;
|
|
7357
|
-
}
|
|
7358
|
-
const location = content.valueLocation;
|
|
7359
|
-
const value = parseContent(content.value.toString());
|
|
7360
|
-
if (!value) {
|
|
7361
|
-
this.report(target, "Malformed meta refresh directive", location);
|
|
7362
|
-
return;
|
|
7363
|
-
}
|
|
7364
|
-
const { delay, url } = value;
|
|
7365
|
-
this.validateDelay(target, location, delay, url);
|
|
7366
|
-
});
|
|
7367
|
-
}
|
|
7368
|
-
validateDelay(target, location, delay, url) {
|
|
7369
|
-
const { allowLongDelay } = this.options;
|
|
7370
|
-
if (allowLongDelay && delay > 72e3) {
|
|
7371
|
-
return;
|
|
7372
|
-
}
|
|
7373
|
-
if (!url && delay === 0) {
|
|
7374
|
-
this.report(target, "Don't use instant meta refresh to reload the page", location);
|
|
7375
|
-
return;
|
|
7376
|
-
}
|
|
7377
|
-
if (delay !== 0) {
|
|
7378
|
-
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)";
|
|
7379
|
-
this.report(target, message, location);
|
|
7380
|
-
}
|
|
7381
|
-
}
|
|
7382
|
-
}
|
|
7383
|
-
function parseContent(text) {
|
|
7384
|
-
const match = /^(\d+)(?:\s*;\s*url=(.*))?/i.exec(text);
|
|
7385
|
-
if (match) {
|
|
7386
|
-
return {
|
|
7387
|
-
delay: parseInt(match[1], 10),
|
|
7388
|
-
url: match[2]
|
|
7389
|
-
};
|
|
7390
|
-
} else {
|
|
7391
|
-
return null;
|
|
7392
|
-
}
|
|
7393
|
-
}
|
|
7394
|
-
|
|
7395
7218
|
function getName(attr) {
|
|
7396
7219
|
const name = attr.value;
|
|
7397
7220
|
if (!name || name instanceof DynamicValue) {
|
|
@@ -7454,16 +7277,79 @@ class MapIdName extends Rule {
|
|
|
7454
7277
|
if (!hasStaticValue(id) || !hasStaticValue(name)) {
|
|
7455
7278
|
return;
|
|
7456
7279
|
}
|
|
7457
|
-
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) {
|
|
7316
|
+
return;
|
|
7317
|
+
}
|
|
7318
|
+
const location = content.valueLocation;
|
|
7319
|
+
const value = parseContent(content.value.toString());
|
|
7320
|
+
if (!value) {
|
|
7321
|
+
this.report(target, "Malformed meta refresh directive", location);
|
|
7458
7322
|
return;
|
|
7459
7323
|
}
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
message: `"id" and "name" attribute must be the same on <map> elements`,
|
|
7463
|
-
location: id.valueLocation ?? name.valueLocation
|
|
7464
|
-
});
|
|
7324
|
+
const { delay, url } = value;
|
|
7325
|
+
this.validateDelay(target, location, delay, url);
|
|
7465
7326
|
});
|
|
7466
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
|
+
}
|
|
7467
7353
|
}
|
|
7468
7354
|
|
|
7469
7355
|
class MissingDoctype extends Rule {
|
|
@@ -7862,30 +7748,6 @@ class NoImplicitButtonType extends Rule {
|
|
|
7862
7748
|
}
|
|
7863
7749
|
}
|
|
7864
7750
|
|
|
7865
|
-
function isRelevant$1(event) {
|
|
7866
|
-
return event.target.is("input");
|
|
7867
|
-
}
|
|
7868
|
-
class NoImplicitInputType extends Rule {
|
|
7869
|
-
documentation() {
|
|
7870
|
-
return {
|
|
7871
|
-
description: ["`<input>` is missing recommended `type` attribute"].join("\n"),
|
|
7872
|
-
url: "https://html-validate.org/rules/no-implicit-input-type.html"
|
|
7873
|
-
};
|
|
7874
|
-
}
|
|
7875
|
-
setup() {
|
|
7876
|
-
this.on("element:ready", isRelevant$1, (event) => {
|
|
7877
|
-
const { target } = event;
|
|
7878
|
-
const attr = target.getAttribute("type");
|
|
7879
|
-
if (!attr) {
|
|
7880
|
-
this.report({
|
|
7881
|
-
node: event.target,
|
|
7882
|
-
message: `<input> is missing recommended "type" attribute`
|
|
7883
|
-
});
|
|
7884
|
-
}
|
|
7885
|
-
});
|
|
7886
|
-
}
|
|
7887
|
-
}
|
|
7888
|
-
|
|
7889
7751
|
class NoImplicitClose extends Rule {
|
|
7890
7752
|
documentation() {
|
|
7891
7753
|
return {
|
|
@@ -7938,6 +7800,30 @@ Omitted end tags can be ambigious for humans to read and many editors have troub
|
|
|
7938
7800
|
}
|
|
7939
7801
|
}
|
|
7940
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
|
+
|
|
7941
7827
|
const defaults$e = {
|
|
7942
7828
|
include: null,
|
|
7943
7829
|
exclude: null,
|
|
@@ -8168,7 +8054,7 @@ class NoRawCharacters extends Rule {
|
|
|
8168
8054
|
setup() {
|
|
8169
8055
|
this.on("element:ready", (event) => {
|
|
8170
8056
|
const node = event.target;
|
|
8171
|
-
if (node.
|
|
8057
|
+
if (node.textType !== "text") {
|
|
8172
8058
|
return;
|
|
8173
8059
|
}
|
|
8174
8060
|
for (const child of node.childNodes) {
|
|
@@ -9463,6 +9349,9 @@ class UnknownCharReference extends Rule {
|
|
|
9463
9349
|
setup() {
|
|
9464
9350
|
this.on("element:ready", (event) => {
|
|
9465
9351
|
const node = event.target;
|
|
9352
|
+
if (node.textType !== "text") {
|
|
9353
|
+
return;
|
|
9354
|
+
}
|
|
9466
9355
|
for (const child of node.childNodes) {
|
|
9467
9356
|
if (child.nodeType !== NodeType.TEXT_NODE) {
|
|
9468
9357
|
continue;
|
|
@@ -10688,6 +10577,172 @@ const bundledRules = {
|
|
|
10688
10577
|
...bundledRules$1
|
|
10689
10578
|
};
|
|
10690
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
|
+
|
|
10691
10746
|
function dumpTree(root) {
|
|
10692
10747
|
const lines = [];
|
|
10693
10748
|
function decoration(node) {
|
|
@@ -11823,7 +11878,7 @@ class EventHandler {
|
|
|
11823
11878
|
}
|
|
11824
11879
|
|
|
11825
11880
|
const name = "html-validate";
|
|
11826
|
-
const version = "10.1.
|
|
11881
|
+
const version = "10.1.2";
|
|
11827
11882
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
11828
11883
|
|
|
11829
11884
|
function freeze(src) {
|
|
@@ -14227,5 +14282,5 @@ const engines = {
|
|
|
14227
14282
|
|
|
14228
14283
|
var workerPath = "./jest-worker.js";
|
|
14229
14284
|
|
|
14230
|
-
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 };
|
|
14231
14286
|
//# sourceMappingURL=core.js.map
|