mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2026-01-04 03:54:51 +01:00
Updated to v1.9.9
This commit is contained in:
59
conf/site/node_modules/css-what/lib/parse.js
generated
vendored
59
conf/site/node_modules/css-what/lib/parse.js
generated
vendored
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = parse;
|
||||
var reName = /^[^\\]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/;
|
||||
var reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi;
|
||||
//modified version of https://github.com/jquery/sizzle/blob/master/src/sizzle.js#L87
|
||||
var reAttr = /^\s*((?:\\.|[\w\u00b0-\uFFFF-])+)\s*(?:(\S?)=\s*(?:(['"])([^]*?)\3|(#?(?:\\.|[\w\u00b0-\uFFFF-])*)|)|)\s*(i)?\]/;
|
||||
// Modified version of https://github.com/jquery/sizzle/blob/master/src/sizzle.js#L87
|
||||
var reAttr = /^\s*((?:\\.|[\w\u00b0-\uFFFF-])+)\s*(?:(\S?)=\s*(?:(['"])((?:[^\\]|\\[^])*?)\3|(#?(?:\\.|[\w\u00b0-\uFFFF-])*)|)|)\s*(i)?\]/;
|
||||
var actionTypes = {
|
||||
undefined: "exists",
|
||||
"": "equals",
|
||||
@@ -25,11 +25,18 @@ var attribSelectors = {
|
||||
"#": ["id", "equals"],
|
||||
".": ["class", "element"],
|
||||
};
|
||||
//pseudos, whose data-property is parsed as well
|
||||
var unpackPseudos = new Set(["has", "not", "matches"]);
|
||||
// Pseudos, whose data property is parsed as well.
|
||||
var unpackPseudos = new Set([
|
||||
"has",
|
||||
"not",
|
||||
"matches",
|
||||
"is",
|
||||
"host",
|
||||
"host-context",
|
||||
]);
|
||||
var stripQuotesFromPseudos = new Set(["contains", "icontains"]);
|
||||
var quotes = new Set(['"', "'"]);
|
||||
//unescape function taken from https://github.com/jquery/sizzle/blob/master/src/sizzle.js#L152
|
||||
// Unescape function taken from https://github.com/jquery/sizzle/blob/master/src/sizzle.js#L152
|
||||
function funescape(_, escaped, escapedWhitespace) {
|
||||
var high = parseInt(escaped, 16) - 0x10000;
|
||||
// NaN means non-codepoint
|
||||
@@ -56,6 +63,8 @@ function parse(selector, options) {
|
||||
return subselects;
|
||||
}
|
||||
function parseSelector(subselects, selector, options) {
|
||||
var _a, _b;
|
||||
if (options === void 0) { options = {}; }
|
||||
var tokens = [];
|
||||
var sawWS = false;
|
||||
function getName() {
|
||||
@@ -111,7 +120,7 @@ function parseSelector(subselects, selector, options) {
|
||||
tokens.push({ type: "universal" });
|
||||
}
|
||||
else if (firstChar in attribSelectors) {
|
||||
var _a = attribSelectors[firstChar], name_1 = _a[0], action = _a[1];
|
||||
var _c = attribSelectors[firstChar], name_1 = _c[0], action = _c[1];
|
||||
selector = selector.substr(1);
|
||||
tokens.push({
|
||||
type: "attribute",
|
||||
@@ -123,24 +132,22 @@ function parseSelector(subselects, selector, options) {
|
||||
}
|
||||
else if (firstChar === "[") {
|
||||
selector = selector.substr(1);
|
||||
var data = selector.match(reAttr);
|
||||
if (!data) {
|
||||
var attributeMatch = selector.match(reAttr);
|
||||
if (!attributeMatch) {
|
||||
throw new Error("Malformed attribute selector: " + selector);
|
||||
}
|
||||
selector = selector.substr(data[0].length);
|
||||
var name_2 = unescapeCSS(data[1]);
|
||||
if (!options ||
|
||||
("lowerCaseAttributeNames" in options
|
||||
? options.lowerCaseAttributeNames
|
||||
: !options.xmlMode)) {
|
||||
var completeSelector = attributeMatch[0], baseName = attributeMatch[1], actionType = attributeMatch[2], _d = attributeMatch[4], quotedValue = _d === void 0 ? "" : _d, _e = attributeMatch[5], value = _e === void 0 ? quotedValue : _e, ignoreCase = attributeMatch[6];
|
||||
selector = selector.substr(completeSelector.length);
|
||||
var name_2 = unescapeCSS(baseName);
|
||||
if ((_a = options.lowerCaseAttributeNames) !== null && _a !== void 0 ? _a : !options.xmlMode) {
|
||||
name_2 = name_2.toLowerCase();
|
||||
}
|
||||
tokens.push({
|
||||
type: "attribute",
|
||||
name: name_2,
|
||||
action: actionTypes[data[2]],
|
||||
value: unescapeCSS(data[4] || data[5] || ""),
|
||||
ignoreCase: !!data[6],
|
||||
action: actionTypes[actionType],
|
||||
value: unescapeCSS(value),
|
||||
ignoreCase: !!ignoreCase,
|
||||
});
|
||||
}
|
||||
else if (firstChar === ":") {
|
||||
@@ -155,7 +162,7 @@ function parseSelector(subselects, selector, options) {
|
||||
selector = selector.substr(1);
|
||||
var name_3 = getName().toLowerCase();
|
||||
var data = null;
|
||||
if (selector.charAt(0) === "(") {
|
||||
if (selector.startsWith("(")) {
|
||||
if (unpackPseudos.has(name_3)) {
|
||||
var quot = selector.charAt(1);
|
||||
var quoted = quotes.has(quot);
|
||||
@@ -163,14 +170,14 @@ function parseSelector(subselects, selector, options) {
|
||||
data = [];
|
||||
selector = parseSelector(data, selector, options);
|
||||
if (quoted) {
|
||||
if (selector.charAt(0) !== quot) {
|
||||
if (!selector.startsWith(quot)) {
|
||||
throw new Error("Unmatched quotes in :" + name_3);
|
||||
}
|
||||
else {
|
||||
selector = selector.substr(1);
|
||||
}
|
||||
}
|
||||
if (selector.charAt(0) !== ")") {
|
||||
if (!selector.startsWith(")")) {
|
||||
throw new Error("Missing closing parenthesis in :" + name_3 + " (" + selector + ")");
|
||||
}
|
||||
selector = selector.substr(1);
|
||||
@@ -179,11 +186,14 @@ function parseSelector(subselects, selector, options) {
|
||||
var pos = 1;
|
||||
var counter = 1;
|
||||
for (; counter > 0 && pos < selector.length; pos++) {
|
||||
if (selector.charAt(pos) === "(" && !isEscaped(pos))
|
||||
if (selector.charAt(pos) === "(" &&
|
||||
!isEscaped(pos)) {
|
||||
counter++;
|
||||
}
|
||||
else if (selector.charAt(pos) === ")" &&
|
||||
!isEscaped(pos))
|
||||
!isEscaped(pos)) {
|
||||
counter--;
|
||||
}
|
||||
}
|
||||
if (counter) {
|
||||
throw new Error("Parenthesis not matched");
|
||||
@@ -203,10 +213,7 @@ function parseSelector(subselects, selector, options) {
|
||||
}
|
||||
else if (reName.test(selector)) {
|
||||
var name_4 = getName();
|
||||
if (!options ||
|
||||
("lowerCaseTags" in options
|
||||
? options.lowerCaseTags
|
||||
: !options.xmlMode)) {
|
||||
if ((_b = options.lowerCaseTags) !== null && _b !== void 0 ? _b : !options.xmlMode) {
|
||||
name_4 = name_4.toLowerCase();
|
||||
}
|
||||
tokens.push({ type: "tag", name: name_4 });
|
||||
|
||||
Reference in New Issue
Block a user