{"id":15823,"library":"slick","title":"Slick CSS Selector Engine","description":"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.","status":"abandoned","version":"1.12.2","language":"javascript","source_language":"en","source_url":"git://github.com/kamicane/slick","tags":["javascript","dom","css","selector","finder","parser"],"install":[{"cmd":"npm install slick","lang":"bash","label":"npm"},{"cmd":"yarn add slick","lang":"bash","label":"yarn"},{"cmd":"pnpm add slick","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package is a CommonJS module and does not officially support ESM `import` statements. The entire module's functionality is exposed via a single `slick` object.","wrong":"import slick from 'slick'","symbol":"slick","correct":"const slick = require('slick')"},{"note":"The `search` function is a method on the `slick` object exported by the CommonJS module. It is not available as a named ESM export.","wrong":"import { search } from 'slick'","symbol":"search","correct":"const slick = require('slick'); slick.search(...)"},{"note":"The `parse` function is a method on the `slick` object exported by the CommonJS module. It is not available as a named ESM export.","wrong":"import { parse } from 'slick'","symbol":"parse","correct":"const slick = require('slick'); slick.parse(...)"}],"quickstart":{"code":"const { JSDOM } = require('jsdom');\nconst slick = require('slick');\n\n// Setup a simple DOM environment for demonstration\nconst dom = new JSDOM(`\n  <!DOCTYPE html>\n  <html>\n  <body>\n    <div id=\"container\">\n      <ul class=\"list\">\n        <li>Item 1</li>\n        <li class=\"active\">Item 2</li>\n      </ul>\n      <p>A paragraph</p>\n      <ul class=\"list\">\n        <li>Another Item</li>\n      </ul>\n    </div>\n  </body>\n  </html>\n`);\nconst document = dom.window.document;\n\nconsole.log('--- Using slick.parse ---\\n');\nconst selectorObject = slick.parse('ul.list > li.active');\nconsole.log('Parsed Selector Object:', JSON.stringify(selectorObject, null, 2));\n\nconsole.log('\\n--- Using slick.search ---\\n');\nconst foundElements = slick.search('ul.list > li.active', document);\nconsole.log('Found Elements:', foundElements.map(el => el.outerHTML));\n\nconsole.log('\\n--- Using slick.find ---\\n');\nconst firstFoundElement = slick.find('li:first-child', document);\nconsole.log('First Found Element:', firstFoundElement ? firstFoundElement.outerHTML : 'None');\n\nconsole.log('\\n--- Using slick.matches ---\\n');\nconst targetElement = document.querySelector('.active');\nconst matches = slick.matches(targetElement, 'li.active');\nconsole.log(`Does <li class=\"active\"> match 'li.active'? ${matches}`);","lang":"javascript","description":"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."},"warnings":[{"fix":"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.","message":"The `slick` project appears to be abandoned, with no updates or commits in over nine years. This means there will be no bug fixes, performance improvements, or security patches for any discovered vulnerabilities.","severity":"breaking","affected_versions":">=1.12.2"},{"fix":"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.","message":"Slick is a CommonJS-only module and does not natively support ECMAScript Modules (ESM) `import` statements. Attempting to use `import` will likely result in module resolution errors or undefined behavior.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"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.","message":"Due to its age, `slick` may not fully support modern CSS selectors (e.g., `:is()`, `:where()`, `:has()`) or might have compatibility issues with newer browser features or edge cases. Its performance might also lag behind native browser implementations.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"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.","message":"The `slick` package does not provide TypeScript declaration files (`.d.ts`). Using it in a TypeScript project will result in type errors and lack of autocompletion without manual type declarations.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Ensure you are importing the module correctly using `const slick = require('slick');` in a CommonJS environment.","cause":"Attempting to call `slick.search` after an incorrect ESM import, or if `slick` was not properly assigned the module's export.","error":"TypeError: slick.search is not a function"},{"fix":"Add `const slick = require('slick');` at the top of your JavaScript file to properly import and define the `slick` object.","cause":"Trying to access the `slick` object in a Node.js environment without explicitly importing it first, or assuming it's a global variable.","error":"ReferenceError: slick is not defined"},{"fix":"Import the entire module as a single object using `const slick = require('slick');` and then access methods as properties, e.g., `slick.search()`.","cause":"Attempting to use named imports (e.g., `import { search } from 'slick'`) from the `slick` module. Slick is a CommonJS module that exports a single object, not named exports.","error":"SyntaxError: Named export 'search' not found..."}],"ecosystem":"npm"}