html-validate 11.5.2 → 11.5.3
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 +38 -17
- package/dist/cjs/core.js.map +1 -1
- package/dist/esm/core.js +38 -17
- package/dist/esm/core.js.map +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/cjs/core.js
CHANGED
|
@@ -2063,19 +2063,19 @@ function lastChild(node) {
|
|
|
2063
2063
|
return node.nextSibling === null;
|
|
2064
2064
|
}
|
|
2065
2065
|
|
|
2066
|
-
const cache = {};
|
|
2066
|
+
const cache$1 = {};
|
|
2067
2067
|
function getNthChild(node) {
|
|
2068
2068
|
if (!node.parent) {
|
|
2069
2069
|
return -1;
|
|
2070
2070
|
}
|
|
2071
|
-
if (!cache[node.unique]) {
|
|
2071
|
+
if (!cache$1[node.unique]) {
|
|
2072
2072
|
const parent = node.parent;
|
|
2073
2073
|
const index = parent.childElements.findIndex((cur) => {
|
|
2074
2074
|
return cur.unique === node.unique;
|
|
2075
2075
|
});
|
|
2076
|
-
cache[node.unique] = index + 1;
|
|
2076
|
+
cache$1[node.unique] = index + 1;
|
|
2077
2077
|
}
|
|
2078
|
-
return cache[node.unique];
|
|
2078
|
+
return cache$1[node.unique];
|
|
2079
2079
|
}
|
|
2080
2080
|
function nthChild(node, args) {
|
|
2081
2081
|
if (!args) {
|
|
@@ -2489,9 +2489,16 @@ function generateIdSelector(id) {
|
|
|
2489
2489
|
return /^\d/.test(escaped) ? `[id="${escaped}"]` : `#${escaped}`;
|
|
2490
2490
|
}
|
|
2491
2491
|
|
|
2492
|
+
const cache = /* @__PURE__ */ new Map();
|
|
2492
2493
|
function parseSelector(selector) {
|
|
2494
|
+
const cached = cache.get(selector);
|
|
2495
|
+
if (cached) {
|
|
2496
|
+
return cached;
|
|
2497
|
+
}
|
|
2493
2498
|
const compounds = getCompounds(selector);
|
|
2494
|
-
|
|
2499
|
+
const result = ComplexSelector.fromCompounds(compounds);
|
|
2500
|
+
cache.set(selector, result);
|
|
2501
|
+
return result;
|
|
2495
2502
|
}
|
|
2496
2503
|
|
|
2497
2504
|
const TEXT_NODE_NAME = "#text";
|
|
@@ -3010,9 +3017,17 @@ class HtmlElement extends DOMNode {
|
|
|
3010
3017
|
return i <= this.siblings.length - 2 ? this.siblings[i + 1] : null;
|
|
3011
3018
|
}
|
|
3012
3019
|
getElementsByTagName(tagName) {
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3020
|
+
const matches = [];
|
|
3021
|
+
this.collectByTagName(tagName, matches);
|
|
3022
|
+
return matches;
|
|
3023
|
+
}
|
|
3024
|
+
collectByTagName(tagName, matches) {
|
|
3025
|
+
for (const node of this.childElements) {
|
|
3026
|
+
if (node.is(tagName)) {
|
|
3027
|
+
matches.push(node);
|
|
3028
|
+
}
|
|
3029
|
+
node.collectByTagName(tagName, matches);
|
|
3030
|
+
}
|
|
3016
3031
|
}
|
|
3017
3032
|
querySelector(selector) {
|
|
3018
3033
|
const it = this.querySelectorImpl(selector);
|
|
@@ -4816,14 +4831,20 @@ class Context {
|
|
|
4816
4831
|
return JSON.stringify(this.string.length > n ? `${this.string.slice(0, 10)}...` : this.string);
|
|
4817
4832
|
}
|
|
4818
4833
|
consume(n, state) {
|
|
4819
|
-
let
|
|
4820
|
-
let
|
|
4821
|
-
|
|
4822
|
-
this.
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4834
|
+
let lastNewline = -1;
|
|
4835
|
+
let newlines = 0;
|
|
4836
|
+
for (let i = 0; i < n; i++) {
|
|
4837
|
+
if (this.string[i] === "\n") {
|
|
4838
|
+
newlines++;
|
|
4839
|
+
lastNewline = i;
|
|
4840
|
+
}
|
|
4841
|
+
}
|
|
4842
|
+
if (newlines > 0) {
|
|
4843
|
+
this.line += newlines;
|
|
4844
|
+
this.column = n - lastNewline;
|
|
4845
|
+
} else {
|
|
4846
|
+
this.column += n;
|
|
4847
|
+
}
|
|
4827
4848
|
this.offset += n;
|
|
4828
4849
|
this.string = this.string.slice(n);
|
|
4829
4850
|
this.state = state;
|
|
@@ -12832,7 +12853,7 @@ class EventHandler {
|
|
|
12832
12853
|
}
|
|
12833
12854
|
|
|
12834
12855
|
const name = "html-validate";
|
|
12835
|
-
const version = "11.5.
|
|
12856
|
+
const version = "11.5.3";
|
|
12836
12857
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
12837
12858
|
|
|
12838
12859
|
function freeze(src) {
|