html-validate 10.16.0 → 10.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/core.js +51 -1
- package/dist/cjs/core.js.map +1 -1
- package/dist/esm/core.js +51 -1
- package/dist/esm/core.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/core.js
CHANGED
|
@@ -8972,6 +8972,55 @@ class NoTrailingWhitespace extends Rule {
|
|
|
8972
8972
|
}
|
|
8973
8973
|
}
|
|
8974
8974
|
|
|
8975
|
+
const skipPatterns = [
|
|
8976
|
+
/^data-/i,
|
|
8977
|
+
/^aria-/i,
|
|
8978
|
+
/^on[a-z]/i,
|
|
8979
|
+
/^xml(ns)?:/i,
|
|
8980
|
+
/^:/,
|
|
8981
|
+
/^@/,
|
|
8982
|
+
/^ng-/i,
|
|
8983
|
+
/^v-/i,
|
|
8984
|
+
/^x-/i,
|
|
8985
|
+
/^\[/
|
|
8986
|
+
];
|
|
8987
|
+
function isKnownDynamicAttr(attr) {
|
|
8988
|
+
return skipPatterns.some((pattern) => pattern.test(attr));
|
|
8989
|
+
}
|
|
8990
|
+
class NoUnknownAttributes extends Rule {
|
|
8991
|
+
documentation(context) {
|
|
8992
|
+
return {
|
|
8993
|
+
description: `The \`${context.attr}\` attribute is not a known attribute on \`<${context.tagName}>\`.`,
|
|
8994
|
+
url: "https://html-validate.org/rules/no-unknown-attributes.html"
|
|
8995
|
+
};
|
|
8996
|
+
}
|
|
8997
|
+
setup() {
|
|
8998
|
+
this.on("attr", (event) => {
|
|
8999
|
+
const node = event.target;
|
|
9000
|
+
const meta = node.meta;
|
|
9001
|
+
const attr = event.key.toLowerCase();
|
|
9002
|
+
if (meta === null) {
|
|
9003
|
+
return;
|
|
9004
|
+
}
|
|
9005
|
+
if (attr in meta.attributes) {
|
|
9006
|
+
return;
|
|
9007
|
+
}
|
|
9008
|
+
if (isKnownDynamicAttr(attr)) {
|
|
9009
|
+
return;
|
|
9010
|
+
}
|
|
9011
|
+
this.report({
|
|
9012
|
+
node,
|
|
9013
|
+
message: `Attribute "${event.key}" is not allowed on <${node.tagName}> element`,
|
|
9014
|
+
location: event.keyLocation,
|
|
9015
|
+
context: {
|
|
9016
|
+
tagName: node.tagName,
|
|
9017
|
+
attr: event.key
|
|
9018
|
+
}
|
|
9019
|
+
});
|
|
9020
|
+
});
|
|
9021
|
+
}
|
|
9022
|
+
}
|
|
9023
|
+
|
|
8975
9024
|
const defaults$b = {
|
|
8976
9025
|
include: null,
|
|
8977
9026
|
exclude: null
|
|
@@ -11279,6 +11328,7 @@ const bundledRules = {
|
|
|
11279
11328
|
"no-self-closing": NoSelfClosing,
|
|
11280
11329
|
"no-style-tag": NoStyleTag,
|
|
11281
11330
|
"no-trailing-whitespace": NoTrailingWhitespace,
|
|
11331
|
+
"no-unknown-attributes": NoUnknownAttributes,
|
|
11282
11332
|
"no-unknown-elements": NoUnknownElements,
|
|
11283
11333
|
"no-unused-disable": NoUnusedDisable,
|
|
11284
11334
|
"no-utf8-bom": NoUtf8Bom,
|
|
@@ -12593,7 +12643,7 @@ class EventHandler {
|
|
|
12593
12643
|
}
|
|
12594
12644
|
|
|
12595
12645
|
const name = "html-validate";
|
|
12596
|
-
const version = "10.
|
|
12646
|
+
const version = "10.17.0";
|
|
12597
12647
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
12598
12648
|
|
|
12599
12649
|
function freeze(src) {
|