html-validate 8.11.0 → 8.11.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/dist/cjs/core.js CHANGED
@@ -1963,6 +1963,55 @@ function factory$1(name, context) {
1963
1963
  }
1964
1964
  }
1965
1965
 
1966
+ const escapedCodepoints = ["9", "a", "d"];
1967
+ function* splitSelectorElements(selector) {
1968
+ let begin = 0;
1969
+ let end = 0;
1970
+ function initialState(ch, p) {
1971
+ if (ch === "\\") {
1972
+ return 1 /* ESCAPED */;
1973
+ }
1974
+ if (ch === " ") {
1975
+ end = p;
1976
+ return 2 /* WHITESPACE */;
1977
+ }
1978
+ return 0 /* INITIAL */;
1979
+ }
1980
+ function escapedState(ch) {
1981
+ if (escapedCodepoints.includes(ch)) {
1982
+ return 1 /* ESCAPED */;
1983
+ }
1984
+ return 0 /* INITIAL */;
1985
+ }
1986
+ function* whitespaceState(ch, p) {
1987
+ if (ch === " ") {
1988
+ return 2 /* WHITESPACE */;
1989
+ }
1990
+ yield selector.slice(begin, end);
1991
+ begin = p;
1992
+ end = p;
1993
+ return 0 /* INITIAL */;
1994
+ }
1995
+ let state = 0 /* INITIAL */;
1996
+ for (let p = 0; p < selector.length; p++) {
1997
+ const ch = selector[p];
1998
+ switch (state) {
1999
+ case 0 /* INITIAL */:
2000
+ state = initialState(ch, p);
2001
+ break;
2002
+ case 1 /* ESCAPED */:
2003
+ state = escapedState(ch);
2004
+ break;
2005
+ case 2 /* WHITESPACE */:
2006
+ state = yield* whitespaceState(ch, p);
2007
+ break;
2008
+ }
2009
+ }
2010
+ if (begin !== selector.length) {
2011
+ yield selector.slice(begin);
2012
+ }
2013
+ }
2014
+
1966
2015
  function stripslashes(value) {
1967
2016
  return value.replace(/\\(.)/g, "$1");
1968
2017
  }
@@ -2162,13 +2211,8 @@ class Selector {
2162
2211
  }
2163
2212
  static parse(selector) {
2164
2213
  selector = selector.replace(/([+~>]) /g, "$1");
2165
- let begin = 0;
2166
- const delimiter = /((?:[^\\\u0039\u0061\u0064]) +|$)/g;
2167
- return Array.from(selector.matchAll(delimiter), (match) => {
2168
- const end = match.index + 1;
2169
- const part = unescapeCodepoint(selector.slice(begin, end));
2170
- begin = end + 1;
2171
- return new Pattern(part);
2214
+ return Array.from(splitSelectorElements(selector), (element) => {
2215
+ return new Pattern(unescapeCodepoint(element));
2172
2216
  });
2173
2217
  }
2174
2218
  static findCandidates(root, pattern) {
@@ -11870,7 +11914,7 @@ class HtmlValidate {
11870
11914
  }
11871
11915
 
11872
11916
  const name = "html-validate";
11873
- const version = "8.11.0";
11917
+ const version = "8.11.1";
11874
11918
  const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
11875
11919
 
11876
11920
  function definePlugin(plugin) {