css-select
Advanced tools
Comparing version 4.1.3 to 4.2.0
@@ -66,3 +66,3 @@ "use strict"; | ||
} | ||
var regex = new RegExp("(?:^|\\s)" + escapeRegex(value) + "(?:$|\\s)", ignoreCase ? "i" : ""); | ||
var regex = new RegExp("(?:^|\\s)".concat(escapeRegex(value), "(?:$|\\s)"), ignoreCase ? "i" : ""); | ||
return function element(elem) { | ||
@@ -69,0 +69,0 @@ var attr = adapter.getAttributeValue(elem, name); |
@@ -22,7 +22,7 @@ "use strict"; | ||
var next = compileUnsafe(selector, options, context); | ||
return subselects_1.ensureIsTag(next, options.adapter); | ||
return (0, subselects_1.ensureIsTag)(next, options.adapter); | ||
} | ||
exports.compile = compile; | ||
function compileUnsafe(selector, options, context) { | ||
var token = typeof selector === "string" ? css_what_1.parse(selector, options) : selector; | ||
var token = typeof selector === "string" ? (0, css_what_1.parse)(selector, options) : selector; | ||
return compileToken(token, options, context); | ||
@@ -55,3 +55,3 @@ } | ||
var t = token_1[_i]; | ||
if (t.length > 0 && procedure_1.isTraversal(t[0]) && t[0].type !== "descendant") { | ||
if (t.length > 0 && (0, procedure_1.isTraversal)(t[0]) && t[0].type !== "descendant") { | ||
// Don't continue in else branch | ||
@@ -104,3 +104,3 @@ } | ||
? boolbase_1.falseFunc | ||
: general_1.compileGeneralSelector(previous, rule, options, context, compileToken); | ||
: (0, general_1.compileGeneralSelector)(previous, rule, options, context, compileToken); | ||
}, (_a = options.rootFunc) !== null && _a !== void 0 ? _a : boolbase_1.trueFunc); | ||
@@ -107,0 +107,0 @@ } |
@@ -17,3 +17,3 @@ "use strict"; | ||
case "pseudo": | ||
return pseudo_selectors_1.compilePseudoSelector(next, selector, options, context, compileToken); | ||
return (0, pseudo_selectors_1.compilePseudoSelector)(next, selector, options, context, compileToken); | ||
// Tags | ||
@@ -20,0 +20,0 @@ case "tag": |
@@ -61,3 +61,3 @@ "use strict"; | ||
if (typeof query !== "function") { | ||
query = compile_1.compileUnsafe(query, opts, elements); | ||
query = (0, compile_1.compileUnsafe)(query, opts, elements); | ||
} | ||
@@ -86,3 +86,3 @@ var filteredElements = prepareContext(elements, opts.adapter, query.shouldTestNextSiblings); | ||
for (var i = 0; i < elems.length; i++) { | ||
var nextSiblings = subselects_1.getNextSiblings(elems[i], adapter); | ||
var nextSiblings = (0, subselects_1.getNextSiblings)(elems[i], adapter); | ||
elems.push.apply(elems, nextSiblings); | ||
@@ -134,3 +134,3 @@ } | ||
var opts = convertOptionFormats(options); | ||
return (typeof query === "function" ? query : compile_1.compile(query, opts))(elem); | ||
return (typeof query === "function" ? query : (0, compile_1.compile)(query, opts))(elem); | ||
} | ||
@@ -137,0 +137,0 @@ exports.is = is; |
@@ -33,3 +33,3 @@ "use strict"; | ||
var adapter = _a.adapter, equals = _a.equals; | ||
var func = nth_check_1.default(rule); | ||
var func = (0, nth_check_1.default)(rule); | ||
if (func === boolbase_1.falseFunc) | ||
@@ -54,3 +54,3 @@ return boolbase_1.falseFunc; | ||
var adapter = _a.adapter, equals = _a.equals; | ||
var func = nth_check_1.default(rule); | ||
var func = (0, nth_check_1.default)(rule); | ||
if (func === boolbase_1.falseFunc) | ||
@@ -75,3 +75,3 @@ return boolbase_1.falseFunc; | ||
var adapter = _a.adapter, equals = _a.equals; | ||
var func = nth_check_1.default(rule); | ||
var func = (0, nth_check_1.default)(rule); | ||
if (func === boolbase_1.falseFunc) | ||
@@ -98,3 +98,3 @@ return boolbase_1.falseFunc; | ||
var adapter = _a.adapter, equals = _a.equals; | ||
var func = nth_check_1.default(rule); | ||
var func = (0, nth_check_1.default)(rule); | ||
if (func === boolbase_1.falseFunc) | ||
@@ -101,0 +101,0 @@ return boolbase_1.falseFunc; |
@@ -34,6 +34,6 @@ "use strict"; | ||
if (data != null) { | ||
throw new Error("Pseudo " + name + " doesn't have any arguments"); | ||
throw new Error("Pseudo ".concat(name, " doesn't have any arguments")); | ||
} | ||
// The alias has to be parsed here, to make sure options are respected. | ||
var alias = css_what_1.parse(aliases_1.aliases[name], options); | ||
var alias = (0, css_what_1.parse)(aliases_1.aliases[name], options); | ||
return subselects_1.subselects.is(next, alias, options, context, compileToken); | ||
@@ -46,3 +46,3 @@ } | ||
var pseudo_1 = pseudos_1.pseudos[name]; | ||
pseudos_1.verifyPseudoArgs(pseudo_1, name, data); | ||
(0, pseudos_1.verifyPseudoArgs)(pseudo_1, name, data); | ||
return pseudo_1 === boolbase_1.falseFunc | ||
@@ -54,4 +54,4 @@ ? boolbase_1.falseFunc | ||
} | ||
throw new Error("unmatched pseudo-class :" + name); | ||
throw new Error("unmatched pseudo-class :".concat(name)); | ||
} | ||
exports.compilePseudoSelector = compilePseudoSelector; |
@@ -82,9 +82,9 @@ "use strict"; | ||
if (func.length > 2) { | ||
throw new Error("pseudo-selector :" + name + " requires an argument"); | ||
throw new Error("pseudo-selector :".concat(name, " requires an argument")); | ||
} | ||
} | ||
else if (func.length === 2) { | ||
throw new Error("pseudo-selector :" + name + " doesn't have any arguments"); | ||
throw new Error("pseudo-selector :".concat(name, " doesn't have any arguments")); | ||
} | ||
} | ||
exports.verifyPseudoArgs = verifyPseudoArgs; |
"use strict"; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -39,3 +43,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
* :not, :has, :is and :matches have to compile selectors | ||
* :not, :has, :is, :matches and :where have to compile selectors | ||
* doing this in src/pseudos.ts would lead to circular dependencies, | ||
@@ -47,5 +51,6 @@ * so we add them here | ||
/** | ||
* `:matches` is an alias for `:is`. | ||
* `:matches` and `:where` are aliases for `:is`. | ||
*/ | ||
matches: is, | ||
where: is, | ||
not: function (next, token, options, context, compileToken) { | ||
@@ -98,3 +103,3 @@ var opts = { | ||
var nextElements = shouldTestNextSiblings | ||
? __spreadArray(__spreadArray([], childs), getNextSiblings(elem, adapter)) : childs; | ||
? __spreadArray(__spreadArray([], childs, true), getNextSiblings(elem, adapter), true) : childs; | ||
return (next(elem) && adapter.existsOne(hasElement, nextElements)); | ||
@@ -101,0 +106,0 @@ }; |
{ | ||
"name": "css-select", | ||
"version": "4.1.3", | ||
"version": "4.2.0", | ||
"description": "a CSS selector compiler/engine", | ||
@@ -25,26 +25,25 @@ "author": "Felix Boehm <me@feedic.com>", | ||
"boolbase": "^1.0.0", | ||
"css-what": "^5.0.0", | ||
"domhandler": "^4.2.0", | ||
"domutils": "^2.6.0", | ||
"nth-check": "^2.0.0" | ||
"css-what": "^5.1.0", | ||
"domhandler": "^4.3.0", | ||
"domutils": "^2.8.0", | ||
"nth-check": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/boolbase": "^1.0.0", | ||
"@types/jest": "^26.0.14", | ||
"@types/node": "^15.0.2", | ||
"@typescript-eslint/eslint-plugin": "^4.1.0", | ||
"@typescript-eslint/parser": "^4.1.0", | ||
"@types/jest": "^27.0.3", | ||
"@types/node": "^16.11.12", | ||
"@typescript-eslint/eslint-plugin": "^5.7.0", | ||
"@typescript-eslint/parser": "^5.7.0", | ||
"cheerio-soupselect": "^0.1.1", | ||
"coveralls": "^3.0.2", | ||
"eslint": "^7.9.0", | ||
"eslint": "^8.4.1", | ||
"eslint-config-prettier": "^8.1.0", | ||
"htmlparser2": "^6.0.0", | ||
"jest": "^27.0.3", | ||
"prettier": "^2.1.2", | ||
"ts-jest": "^27.0.1", | ||
"typescript": "^4.0.2" | ||
"htmlparser2": "^7.2.0", | ||
"jest": "^27.4.5", | ||
"prettier": "^2.5.1", | ||
"ts-jest": "^27.1.1", | ||
"typescript": "^4.5.4" | ||
}, | ||
"scripts": { | ||
"test": "jest --coverage && npm run lint", | ||
"coverage": "cat coverage/lcov.info | coveralls", | ||
"test": "npm run test:jest && npm run lint", | ||
"test:jest": "jest", | ||
"lint": "npm run lint:es && npm run lint:prettier", | ||
@@ -51,0 +50,0 @@ "lint:es": "eslint src", |
Sorry, the diff of this file is not supported yet
77986
13
1313
Updatedcss-what@^5.1.0
Updateddomhandler@^4.3.0
Updateddomutils@^2.8.0
Updatednth-check@^2.0.1