html-validate 10.2.1 → 10.3.1
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 +39 -6
- 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 +39 -6
- package/dist/esm/elements.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/cjs/core.js
CHANGED
|
@@ -1518,6 +1518,7 @@ var State = /* @__PURE__ */ ((State2) => {
|
|
|
1518
1518
|
State2[State2["SCRIPT"] = 7] = "SCRIPT";
|
|
1519
1519
|
State2[State2["STYLE"] = 8] = "STYLE";
|
|
1520
1520
|
State2[State2["TEXTAREA"] = 9] = "TEXTAREA";
|
|
1521
|
+
State2[State2["TITLE"] = 10] = "TITLE";
|
|
1521
1522
|
return State2;
|
|
1522
1523
|
})(State || {});
|
|
1523
1524
|
|
|
@@ -1526,6 +1527,7 @@ var ContentModel = /* @__PURE__ */ ((ContentModel2) => {
|
|
|
1526
1527
|
ContentModel2[ContentModel2["SCRIPT"] = 2] = "SCRIPT";
|
|
1527
1528
|
ContentModel2[ContentModel2["STYLE"] = 3] = "STYLE";
|
|
1528
1529
|
ContentModel2[ContentModel2["TEXTAREA"] = 4] = "TEXTAREA";
|
|
1530
|
+
ContentModel2[ContentModel2["TITLE"] = 5] = "TITLE";
|
|
1529
1531
|
return ContentModel2;
|
|
1530
1532
|
})(ContentModel || {});
|
|
1531
1533
|
class Context {
|
|
@@ -3279,7 +3281,7 @@ class Validator {
|
|
|
3279
3281
|
static validatePermittedCategory(node, category, defaultMatch) {
|
|
3280
3282
|
const [, rawCategory] = /^(@?.*?)([?*]?)$/.exec(category);
|
|
3281
3283
|
if (!rawCategory.startsWith("@")) {
|
|
3282
|
-
return node.
|
|
3284
|
+
return node.matches(rawCategory);
|
|
3283
3285
|
}
|
|
3284
3286
|
if (!node.meta) {
|
|
3285
3287
|
return defaultMatch;
|
|
@@ -4612,6 +4614,8 @@ const MATCH_STYLE_DATA = /^[^]*?(?=<\/style)/;
|
|
|
4612
4614
|
const MATCH_STYLE_END = /^<(\/)(style)/;
|
|
4613
4615
|
const MATCH_TEXTAREA_DATA = /^[^]*?(?=<\/textarea)/;
|
|
4614
4616
|
const MATCH_TEXTAREA_END = /^<(\/)(textarea)/;
|
|
4617
|
+
const MATCH_TITLE_DATA = /^[^]*?(?=<\/title)/;
|
|
4618
|
+
const MATCH_TITLE_END = /^<(\/)(title)/;
|
|
4615
4619
|
const MATCH_DIRECTIVE = /^(<!--\s*\[html-validate-)([a-z0-9-]+)(\s*)(.*?)(]?\s*-->)/;
|
|
4616
4620
|
const MATCH_COMMENT = /^<!--([^]*?)-->/;
|
|
4617
4621
|
const MATCH_CONDITIONAL = /^<!\[([^\]]*?)\]>/;
|
|
@@ -4657,6 +4661,9 @@ class Lexer {
|
|
|
4657
4661
|
case State.TEXTAREA:
|
|
4658
4662
|
yield* this.tokenizeTextarea(context);
|
|
4659
4663
|
break;
|
|
4664
|
+
case State.TITLE:
|
|
4665
|
+
yield* this.tokenizeTitle(context);
|
|
4666
|
+
break;
|
|
4660
4667
|
/* istanbul ignore next: sanity check: should not happen unless adding new states */
|
|
4661
4668
|
default:
|
|
4662
4669
|
this.unhandled(context);
|
|
@@ -4731,6 +4738,8 @@ class Lexer {
|
|
|
4731
4738
|
context.contentModel = ContentModel.STYLE;
|
|
4732
4739
|
} else if (data[0] === "<textarea") {
|
|
4733
4740
|
context.contentModel = ContentModel.TEXTAREA;
|
|
4741
|
+
} else if (data[0] === "<title") {
|
|
4742
|
+
context.contentModel = ContentModel.TITLE;
|
|
4734
4743
|
} else {
|
|
4735
4744
|
context.contentModel = ContentModel.TEXT;
|
|
4736
4745
|
}
|
|
@@ -4788,6 +4797,12 @@ class Lexer {
|
|
|
4788
4797
|
} else {
|
|
4789
4798
|
return State.TEXT;
|
|
4790
4799
|
}
|
|
4800
|
+
case ContentModel.TITLE:
|
|
4801
|
+
if (selfClosed) {
|
|
4802
|
+
return State.TITLE;
|
|
4803
|
+
} else {
|
|
4804
|
+
return State.TEXT;
|
|
4805
|
+
}
|
|
4791
4806
|
}
|
|
4792
4807
|
}
|
|
4793
4808
|
yield* this.match(
|
|
@@ -4862,6 +4877,16 @@ class Lexer {
|
|
|
4862
4877
|
"expected </textarea>"
|
|
4863
4878
|
);
|
|
4864
4879
|
}
|
|
4880
|
+
*tokenizeTitle(context) {
|
|
4881
|
+
yield* this.match(
|
|
4882
|
+
context,
|
|
4883
|
+
[
|
|
4884
|
+
[MATCH_TITLE_END, State.TAG, TokenType.TAG_OPEN],
|
|
4885
|
+
[MATCH_TITLE_DATA, State.TITLE, TokenType.TEXT]
|
|
4886
|
+
],
|
|
4887
|
+
"expected </title>"
|
|
4888
|
+
);
|
|
4889
|
+
}
|
|
4865
4890
|
}
|
|
4866
4891
|
|
|
4867
4892
|
const whitespace = /(\s+)/;
|
|
@@ -7774,6 +7799,9 @@ class NoImplicitButtonType extends Rule {
|
|
|
7774
7799
|
setup() {
|
|
7775
7800
|
this.on("element:ready", isRelevant$2, (event) => {
|
|
7776
7801
|
const { target } = event;
|
|
7802
|
+
if (target.parent?.is("select")) {
|
|
7803
|
+
return;
|
|
7804
|
+
}
|
|
7777
7805
|
const attr = target.getAttribute("type");
|
|
7778
7806
|
if (!attr) {
|
|
7779
7807
|
this.report({
|
|
@@ -9113,6 +9141,9 @@ function haveAccessibleText(node) {
|
|
|
9113
9141
|
if (node.is("img") && hasNonEmptyAttribute(node, "alt")) {
|
|
9114
9142
|
return true;
|
|
9115
9143
|
}
|
|
9144
|
+
if (node.is("selectedcontent")) {
|
|
9145
|
+
return true;
|
|
9146
|
+
}
|
|
9116
9147
|
if (hasDefaultText(node)) {
|
|
9117
9148
|
return true;
|
|
9118
9149
|
}
|
|
@@ -11914,7 +11945,7 @@ class EventHandler {
|
|
|
11914
11945
|
}
|
|
11915
11946
|
|
|
11916
11947
|
const name = "html-validate";
|
|
11917
|
-
const version = "10.
|
|
11948
|
+
const version = "10.3.1";
|
|
11918
11949
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
11919
11950
|
|
|
11920
11951
|
function freeze(src) {
|