Slick is a standalone JavaScript library designed for parsing CSS selectors into an object representation and finding DOM nodes based on those selectors. It provides a 'Finder' component for querying the DOM (with methods like `search` and `find`) and a 'Parser' component for converting CSS selector strings into a structured JavaScript object. The current stable version, 1.12.2, was released nine years ago, indicating the project is no longer actively maintained. Key differentiators include its ability to parse selectors into a detailed object, support for custom pseudo-classes, and functionality for searching within XML documents. Its primary use case is in environments where a lightweight, self-contained selector engine is required without external dependencies. This library predates modern browser native selector APIs and module systems, making it primarily a legacy solution.
npm install slickVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use Slick in a Node.js environment. It shows how to initialize `slick` using CommonJS `require`, parse a CSS selector string into an object, and then use the `search`, `find`, and `matches` methods to query a simulated DOM structure provided by `jsdom`. The `jsdom` library is used here solely for demonstration purposes to create a browser-like DOM context within Node.js, and is not a dependency of `slick` itself.
Consider migrating to modern, actively maintained CSS selector engines or utilizing native DOM APIs like `document.querySelector` and `document.querySelectorAll`, which are widely supported, performant, and secure.
Always use `const slick = require('slick')` for module loading in Node.js environments. If you must use it in an ESM context, you might need a transpilation step or a CommonJS wrapper.Thoroughly test `slick` in your target browser environments for selector compatibility and performance. For modern web development, relying on native `querySelector` and `querySelectorAll` is generally recommended.
You will need to create your own `slick.d.ts` declaration file to provide type information for the module and its methods if you are using TypeScript.
Ensure you are importing the module correctly using `const slick = require('slick');` in a CommonJS environment.Add `const slick = require('slick');` at the top of your JavaScript file to properly import and define the `slick` object.Import the entire module as a single object using `const slick = require('slick');` and then access methods as properties, e.g., `slick.search()`.No dependency data recorded yet.