html-validate 10.2.1 → 10.3.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/README.md +2 -2
- package/dist/cjs/core.js +33 -2
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/elements.js +21 -4
- package/dist/cjs/elements.js.map +1 -1
- package/dist/cjs/tsdoc-metadata.json +1 -1
- package/dist/esm/core.js +33 -2
- package/dist/esm/core.js.map +1 -1
- package/dist/esm/elements.js +21 -4
- package/dist/esm/elements.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +1 -1
package/dist/esm/core.js
CHANGED
|
@@ -1509,6 +1509,7 @@ var State = /* @__PURE__ */ ((State2) => {
|
|
|
1509
1509
|
State2[State2["SCRIPT"] = 7] = "SCRIPT";
|
|
1510
1510
|
State2[State2["STYLE"] = 8] = "STYLE";
|
|
1511
1511
|
State2[State2["TEXTAREA"] = 9] = "TEXTAREA";
|
|
1512
|
+
State2[State2["TITLE"] = 10] = "TITLE";
|
|
1512
1513
|
return State2;
|
|
1513
1514
|
})(State || {});
|
|
1514
1515
|
|
|
@@ -1517,6 +1518,7 @@ var ContentModel = /* @__PURE__ */ ((ContentModel2) => {
|
|
|
1517
1518
|
ContentModel2[ContentModel2["SCRIPT"] = 2] = "SCRIPT";
|
|
1518
1519
|
ContentModel2[ContentModel2["STYLE"] = 3] = "STYLE";
|
|
1519
1520
|
ContentModel2[ContentModel2["TEXTAREA"] = 4] = "TEXTAREA";
|
|
1521
|
+
ContentModel2[ContentModel2["TITLE"] = 5] = "TITLE";
|
|
1520
1522
|
return ContentModel2;
|
|
1521
1523
|
})(ContentModel || {});
|
|
1522
1524
|
class Context {
|
|
@@ -3270,7 +3272,7 @@ class Validator {
|
|
|
3270
3272
|
static validatePermittedCategory(node, category, defaultMatch) {
|
|
3271
3273
|
const [, rawCategory] = /^(@?.*?)([?*]?)$/.exec(category);
|
|
3272
3274
|
if (!rawCategory.startsWith("@")) {
|
|
3273
|
-
return node.
|
|
3275
|
+
return node.matches(rawCategory);
|
|
3274
3276
|
}
|
|
3275
3277
|
if (!node.meta) {
|
|
3276
3278
|
return defaultMatch;
|
|
@@ -4603,6 +4605,8 @@ const MATCH_STYLE_DATA = /^[^]*?(?=<\/style)/;
|
|
|
4603
4605
|
const MATCH_STYLE_END = /^<(\/)(style)/;
|
|
4604
4606
|
const MATCH_TEXTAREA_DATA = /^[^]*?(?=<\/textarea)/;
|
|
4605
4607
|
const MATCH_TEXTAREA_END = /^<(\/)(textarea)/;
|
|
4608
|
+
const MATCH_TITLE_DATA = /^[^]*?(?=<\/title)/;
|
|
4609
|
+
const MATCH_TITLE_END = /^<(\/)(title)/;
|
|
4606
4610
|
const MATCH_DIRECTIVE = /^(<!--\s*\[html-validate-)([a-z0-9-]+)(\s*)(.*?)(]?\s*-->)/;
|
|
4607
4611
|
const MATCH_COMMENT = /^<!--([^]*?)-->/;
|
|
4608
4612
|
const MATCH_CONDITIONAL = /^<!\[([^\]]*?)\]>/;
|
|
@@ -4648,6 +4652,9 @@ class Lexer {
|
|
|
4648
4652
|
case State.TEXTAREA:
|
|
4649
4653
|
yield* this.tokenizeTextarea(context);
|
|
4650
4654
|
break;
|
|
4655
|
+
case State.TITLE:
|
|
4656
|
+
yield* this.tokenizeTitle(context);
|
|
4657
|
+
break;
|
|
4651
4658
|
/* istanbul ignore next: sanity check: should not happen unless adding new states */
|
|
4652
4659
|
default:
|
|
4653
4660
|
this.unhandled(context);
|
|
@@ -4722,6 +4729,8 @@ class Lexer {
|
|
|
4722
4729
|
context.contentModel = ContentModel.STYLE;
|
|
4723
4730
|
} else if (data[0] === "<textarea") {
|
|
4724
4731
|
context.contentModel = ContentModel.TEXTAREA;
|
|
4732
|
+
} else if (data[0] === "<title") {
|
|
4733
|
+
context.contentModel = ContentModel.TITLE;
|
|
4725
4734
|
} else {
|
|
4726
4735
|
context.contentModel = ContentModel.TEXT;
|
|
4727
4736
|
}
|
|
@@ -4779,6 +4788,12 @@ class Lexer {
|
|
|
4779
4788
|
} else {
|
|
4780
4789
|
return State.TEXT;
|
|
4781
4790
|
}
|
|
4791
|
+
case ContentModel.TITLE:
|
|
4792
|
+
if (selfClosed) {
|
|
4793
|
+
return State.TITLE;
|
|
4794
|
+
} else {
|
|
4795
|
+
return State.TEXT;
|
|
4796
|
+
}
|
|
4782
4797
|
}
|
|
4783
4798
|
}
|
|
4784
4799
|
yield* this.match(
|
|
@@ -4853,6 +4868,16 @@ class Lexer {
|
|
|
4853
4868
|
"expected </textarea>"
|
|
4854
4869
|
);
|
|
4855
4870
|
}
|
|
4871
|
+
*tokenizeTitle(context) {
|
|
4872
|
+
yield* this.match(
|
|
4873
|
+
context,
|
|
4874
|
+
[
|
|
4875
|
+
[MATCH_TITLE_END, State.TAG, TokenType.TAG_OPEN],
|
|
4876
|
+
[MATCH_TITLE_DATA, State.TITLE, TokenType.TEXT]
|
|
4877
|
+
],
|
|
4878
|
+
"expected </title>"
|
|
4879
|
+
);
|
|
4880
|
+
}
|
|
4856
4881
|
}
|
|
4857
4882
|
|
|
4858
4883
|
const whitespace = /(\s+)/;
|
|
@@ -7765,6 +7790,9 @@ class NoImplicitButtonType extends Rule {
|
|
|
7765
7790
|
setup() {
|
|
7766
7791
|
this.on("element:ready", isRelevant$2, (event) => {
|
|
7767
7792
|
const { target } = event;
|
|
7793
|
+
if (target.parent?.is("select")) {
|
|
7794
|
+
return;
|
|
7795
|
+
}
|
|
7768
7796
|
const attr = target.getAttribute("type");
|
|
7769
7797
|
if (!attr) {
|
|
7770
7798
|
this.report({
|
|
@@ -9104,6 +9132,9 @@ function haveAccessibleText(node) {
|
|
|
9104
9132
|
if (node.is("img") && hasNonEmptyAttribute(node, "alt")) {
|
|
9105
9133
|
return true;
|
|
9106
9134
|
}
|
|
9135
|
+
if (node.is("selectedcontent")) {
|
|
9136
|
+
return true;
|
|
9137
|
+
}
|
|
9107
9138
|
if (hasDefaultText(node)) {
|
|
9108
9139
|
return true;
|
|
9109
9140
|
}
|
|
@@ -11905,7 +11936,7 @@ class EventHandler {
|
|
|
11905
11936
|
}
|
|
11906
11937
|
|
|
11907
11938
|
const name = "html-validate";
|
|
11908
|
-
const version = "10.
|
|
11939
|
+
const version = "10.3.0";
|
|
11909
11940
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
11910
11941
|
|
|
11911
11942
|
function freeze(src) {
|