🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

css-select

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-select - npm Package Compare versions

Comparing version

to
4.1.0

7

lib/compile.d.ts
import { InternalSelector } from "./types";
import { Selector } from "css-what";
import type { CompiledQuery, InternalOptions } from "./types";

@@ -10,5 +11,5 @@ /**

*/
export declare function compile<Node, ElementNode extends Node>(selector: string, options: InternalOptions<Node, ElementNode>, context?: ElementNode[]): CompiledQuery<ElementNode>;
export declare function compileUnsafe<Node, ElementNode extends Node>(selector: string, options: InternalOptions<Node, ElementNode>, context?: ElementNode[] | ElementNode): CompiledQuery<ElementNode>;
export declare function compileToken<Node, ElementNode extends Node>(token: InternalSelector[][], options: InternalOptions<Node, ElementNode>, context?: ElementNode[] | ElementNode): CompiledQuery<ElementNode>;
export declare function compile<Node, ElementNode extends Node>(selector: string | Selector[][], options: InternalOptions<Node, ElementNode>, context?: ElementNode[]): CompiledQuery<ElementNode>;
export declare function compileUnsafe<Node, ElementNode extends Node>(selector: string | Selector[][], options: InternalOptions<Node, ElementNode>, context?: Node[] | Node): CompiledQuery<ElementNode>;
export declare function compileToken<Node, ElementNode extends Node>(token: InternalSelector[][], options: InternalOptions<Node, ElementNode>, context?: Node[] | Node): CompiledQuery<ElementNode>;
//# sourceMappingURL=compile.d.ts.map

@@ -26,3 +26,3 @@ "use strict";

function compileUnsafe(selector, options, context) {
var token = css_what_1.parse(selector, options);
var token = typeof selector === "string" ? css_what_1.parse(selector, options) : selector;
return compileToken(token, options, context);

@@ -50,5 +50,4 @@ }

var hasContext = !!(context === null || context === void 0 ? void 0 : context.every(function (e) {
var parent = adapter.getParent(e);
return (e === subselects_1.PLACEHOLDER_ELEMENT ||
(parent != null && adapter.isTag(parent)));
var parent = adapter.isTag(e) && adapter.getParent(e);
return e === subselects_1.PLACEHOLDER_ELEMENT || (parent && adapter.isTag(parent));
}));

@@ -55,0 +54,0 @@ for (var _i = 0, token_1 = token; _i < token_1.length; _i++) {

import type { CompiledQuery, InternalOptions, InternalSelector, CompileToken } from "./types";
export declare function compileGeneralSelector<Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, selector: InternalSelector, options: InternalOptions<Node, ElementNode>, context: ElementNode[] | undefined, compileToken: CompileToken<Node, ElementNode>): CompiledQuery<ElementNode>;
export declare function compileGeneralSelector<Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, selector: InternalSelector, options: InternalOptions<Node, ElementNode>, context: Node[] | undefined, compileToken: CompileToken<Node, ElementNode>): CompiledQuery<ElementNode>;
//# sourceMappingURL=general.d.ts.map

@@ -6,6 +6,6 @@ import type { CompiledQuery, Options, Query, Adapter } from "./types";

*/
export declare const compile: <Node_1, ElementNode extends Node_1>(selector: string, options?: Options<ElementNode, ElementNode> | undefined, context?: ElementNode[] | undefined) => CompiledQuery<ElementNode>;
export declare const _compileUnsafe: <Node_1, ElementNode extends Node_1>(selector: string, options?: Options<ElementNode, ElementNode> | undefined, context?: ElementNode[] | undefined) => CompiledQuery<ElementNode>;
export declare const _compileToken: <Node_1, ElementNode extends Node_1>(selector: import("./types").InternalSelector[][], options?: Options<ElementNode, ElementNode> | undefined, context?: ElementNode[] | undefined) => CompiledQuery<ElementNode>;
export declare function prepareContext<Node, ElementNode extends Node>(elems: ElementNode | ElementNode[], adapter: Adapter<Node, ElementNode>, shouldTestNextSiblings?: boolean): Node[];
export declare const compile: <Node_1, ElementNode extends Node_1>(selector: string | import("css-what").Selector[][], options?: Options<ElementNode, ElementNode> | undefined, context?: ElementNode[] | undefined) => CompiledQuery<ElementNode>;
export declare const _compileUnsafe: <Node_1, ElementNode extends Node_1>(selector: string | import("css-what").Selector[][], options?: Options<Node_1, ElementNode> | undefined, context?: Node_1[] | undefined) => CompiledQuery<ElementNode>;
export declare const _compileToken: <Node_1, ElementNode extends Node_1>(selector: import("./types").InternalSelector[][], options?: Options<Node_1, ElementNode> | undefined, context?: Node_1[] | undefined) => CompiledQuery<ElementNode>;
export declare function prepareContext<Node, ElementNode extends Node>(elems: Node | Node[], adapter: Adapter<Node, ElementNode>, shouldTestNextSiblings?: boolean): Node[];
/**

@@ -21,3 +21,3 @@ * @template Node The generic Node type for the DOM adapter being used.

*/
export declare const selectAll: <Node_1, ElementNode extends Node_1>(query: Query<ElementNode>, elements: ElementNode | ElementNode[], options?: Options<Node_1, ElementNode> | undefined) => ElementNode[];
export declare const selectAll: <Node_1, ElementNode extends Node_1>(query: Query<ElementNode>, elements: Node_1 | Node_1[], options?: Options<Node_1, ElementNode> | undefined) => ElementNode[];
/**

@@ -32,3 +32,3 @@ * @template Node The generic Node type for the DOM adapter being used.

*/
export declare const selectOne: <Node_1, ElementNode extends Node_1>(query: Query<ElementNode>, elements: ElementNode | ElementNode[], options?: Options<Node_1, ElementNode> | undefined) => ElementNode | null;
export declare const selectOne: <Node_1, ElementNode extends Node_1>(query: Query<ElementNode>, elements: Node_1 | Node_1[], options?: Options<Node_1, ElementNode> | undefined) => ElementNode | null;
/**

@@ -35,0 +35,0 @@ * Tests whether or not an element is matched by query.

import type { CompiledQuery, InternalOptions } from "../types";
export declare type Filter = <Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, text: string, options: InternalOptions<Node, ElementNode>, context?: ElementNode[]) => CompiledQuery<ElementNode>;
export declare type Filter = <Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, text: string, options: InternalOptions<Node, ElementNode>, context?: Node[]) => CompiledQuery<ElementNode>;
export declare const filters: Record<string, Filter>;
//# sourceMappingURL=filters.d.ts.map

@@ -7,3 +7,3 @@ import type { CompiledQuery, InternalOptions, CompileToken } from "../types";

export { filters, pseudos, aliases };
export declare function compilePseudoSelector<Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, selector: PseudoSelector, options: InternalOptions<Node, ElementNode>, context: ElementNode[] | undefined, compileToken: CompileToken<Node, ElementNode>): CompiledQuery<ElementNode>;
export declare function compilePseudoSelector<Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, selector: PseudoSelector, options: InternalOptions<Node, ElementNode>, context: Node[] | undefined, compileToken: CompileToken<Node, ElementNode>): CompiledQuery<ElementNode>;
//# sourceMappingURL=index.d.ts.map

@@ -7,5 +7,5 @@ import { CompileToken } from "./../types";

export declare function ensureIsTag<Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, adapter: Adapter<Node, ElementNode>): CompiledQuery<ElementNode>;
export declare type Subselect = <Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, subselect: Selector[][], options: InternalOptions<Node, ElementNode>, context: ElementNode[] | undefined, compileToken: CompileToken<Node, ElementNode>) => CompiledQuery<ElementNode>;
export declare type Subselect = <Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, subselect: Selector[][], options: InternalOptions<Node, ElementNode>, context: Node[] | undefined, compileToken: CompileToken<Node, ElementNode>) => CompiledQuery<ElementNode>;
export declare function getNextSiblings<Node, ElementNode extends Node>(elem: Node, adapter: Adapter<Node, ElementNode>): ElementNode[];
export declare const subselects: Record<string, Subselect>;
//# sourceMappingURL=subselects.d.ts.map

@@ -118,4 +118,4 @@ import type { Selector } from "css-what";

}
export declare type Query<ElementNode> = string | CompiledQuery<ElementNode>;
export declare type CompileToken<Node, ElementNode extends Node> = (token: InternalSelector[][], options: InternalOptions<Node, ElementNode>, context?: ElementNode[]) => CompiledQuery<ElementNode>;
export declare type Query<ElementNode> = string | CompiledQuery<ElementNode> | Selector[][];
export declare type CompileToken<Node, ElementNode extends Node> = (token: InternalSelector[][], options: InternalOptions<Node, ElementNode>, context?: Node[]) => CompiledQuery<ElementNode>;
//# sourceMappingURL=types.d.ts.map
{
"name": "css-select",
"version": "4.0.0",
"version": "4.1.0",
"description": "a CSS selector compiler/engine",

@@ -26,4 +26,4 @@ "author": "Felix Boehm <me@feedic.com>",

"css-what": "^5.0.0",
"domhandler": "^4.1.0",
"domutils": "^2.5.1",
"domhandler": "^4.2.0",
"domutils": "^2.6.0",
"nth-check": "^2.0.0"

@@ -33,3 +33,3 @@ },

"@types/jest": "^26.0.14",
"@types/node": "^14.0.5",
"@types/node": "^14.14.41",
"@typescript-eslint/eslint-plugin": "^4.1.0",

@@ -44,3 +44,3 @@ "@typescript-eslint/parser": "^4.1.0",

"prettier": "^2.1.2",
"ts-jest": "^26.4.0",
"ts-jest": "^26.5.5",
"typescript": "^4.0.2"

@@ -47,0 +47,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet