html-validate 6.3.2 → 6.4.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.d.ts +10 -1
- package/dist/cjs/core.js +20 -7
- package/dist/cjs/core.js.map +1 -1
- package/dist/es/core.d.ts +10 -1
- package/dist/es/core.js +20 -7
- package/dist/es/core.js.map +1 -1
- package/package.json +3 -3
package/dist/es/core.d.ts
CHANGED
|
@@ -502,6 +502,8 @@ interface ConditionalEvent extends Event {
|
|
|
502
502
|
location: Location;
|
|
503
503
|
/** Condition including markers. */
|
|
504
504
|
condition: string;
|
|
505
|
+
/** The element containing the conditional, if any. */
|
|
506
|
+
parent: HtmlElement | null;
|
|
505
507
|
}
|
|
506
508
|
/**
|
|
507
509
|
* Event emitted when html-validate directives `<!-- [html-validate-...] -->`
|
|
@@ -651,10 +653,17 @@ declare class Parser {
|
|
|
651
653
|
*/
|
|
652
654
|
private getAttributeLocation;
|
|
653
655
|
protected consumeDirective(token: Token): void;
|
|
656
|
+
/**
|
|
657
|
+
* Consumes conditional comment in tag form.
|
|
658
|
+
*
|
|
659
|
+
* See also the related [[consumeCommend]] method.
|
|
660
|
+
*/
|
|
661
|
+
protected consumeConditional(token: Token): void;
|
|
654
662
|
/**
|
|
655
663
|
* Consumes comment token.
|
|
656
664
|
*
|
|
657
|
-
* Tries to find IE conditional comments and emits conditional token if
|
|
665
|
+
* Tries to find IE conditional comments and emits conditional token if
|
|
666
|
+
* found. See also the related [[consumeConditional]] method.
|
|
658
667
|
*/
|
|
659
668
|
protected consumeComment(token: Token): void;
|
|
660
669
|
/**
|
package/dist/es/core.js
CHANGED
|
@@ -2945,7 +2945,7 @@ var TRANSFORMER_API;
|
|
|
2945
2945
|
/** @public */
|
|
2946
2946
|
const name = "html-validate";
|
|
2947
2947
|
/** @public */
|
|
2948
|
-
const version = "6.
|
|
2948
|
+
const version = "6.4.0";
|
|
2949
2949
|
/** @public */
|
|
2950
2950
|
const homepage = "https://html-validate.org";
|
|
2951
2951
|
/** @public */
|
|
@@ -5987,7 +5987,7 @@ class NoConditionalComment extends Rule {
|
|
|
5987
5987
|
}
|
|
5988
5988
|
setup() {
|
|
5989
5989
|
this.on("conditional", (event) => {
|
|
5990
|
-
this.report(
|
|
5990
|
+
this.report(event.parent, "Use of conditional comments are deprecated", event.location);
|
|
5991
5991
|
});
|
|
5992
5992
|
}
|
|
5993
5993
|
}
|
|
@@ -10484,10 +10484,7 @@ class Parser {
|
|
|
10484
10484
|
this.consumeDirective(token);
|
|
10485
10485
|
break;
|
|
10486
10486
|
case TokenType.CONDITIONAL:
|
|
10487
|
-
this.
|
|
10488
|
-
condition: token.data[1],
|
|
10489
|
-
location: token.location,
|
|
10490
|
-
});
|
|
10487
|
+
this.consumeConditional(token);
|
|
10491
10488
|
break;
|
|
10492
10489
|
case TokenType.COMMENT:
|
|
10493
10490
|
this.consumeComment(token);
|
|
@@ -10792,17 +10789,33 @@ class Parser {
|
|
|
10792
10789
|
location: token.location,
|
|
10793
10790
|
});
|
|
10794
10791
|
}
|
|
10792
|
+
/**
|
|
10793
|
+
* Consumes conditional comment in tag form.
|
|
10794
|
+
*
|
|
10795
|
+
* See also the related [[consumeCommend]] method.
|
|
10796
|
+
*/
|
|
10797
|
+
consumeConditional(token) {
|
|
10798
|
+
const element = this.dom.getActive();
|
|
10799
|
+
this.trigger("conditional", {
|
|
10800
|
+
condition: token.data[1],
|
|
10801
|
+
location: token.location,
|
|
10802
|
+
parent: element,
|
|
10803
|
+
});
|
|
10804
|
+
}
|
|
10795
10805
|
/**
|
|
10796
10806
|
* Consumes comment token.
|
|
10797
10807
|
*
|
|
10798
|
-
* Tries to find IE conditional comments and emits conditional token if
|
|
10808
|
+
* Tries to find IE conditional comments and emits conditional token if
|
|
10809
|
+
* found. See also the related [[consumeConditional]] method.
|
|
10799
10810
|
*/
|
|
10800
10811
|
consumeComment(token) {
|
|
10801
10812
|
const comment = token.data[0];
|
|
10813
|
+
const element = this.dom.getActive();
|
|
10802
10814
|
for (const conditional of parseConditionalComment(comment, token.location)) {
|
|
10803
10815
|
this.trigger("conditional", {
|
|
10804
10816
|
condition: conditional.expression,
|
|
10805
10817
|
location: conditional.location,
|
|
10818
|
+
parent: element,
|
|
10806
10819
|
});
|
|
10807
10820
|
}
|
|
10808
10821
|
}
|