Registry / testing / jelly-sql

jelly-sql

JSON →
library1.1.0jsnpmunverified

Jelly SQL is a JavaScript library that allows querying the DOM using SQL syntax, converting SQL queries into CSS selectors for document.querySelectorAll(). Current stable version is 1.1.0. The library has no third-party dependencies, supports both browser and Node.js, and includes TypeScript type definitions. It provides a familiar query interface for developers accustomed to SQL, differentiating itself from other DOM query libraries by offering a SQL-like abstraction instead of traditional CSS selector strings. The package is actively maintained with a GitHub Actions CI pipeline.

npm install jelly-sql
INSTALL
IMPORT
SIG · JELLY-SQL
J
jelly-sql
testingjavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

query
import { query } from 'jelly-sql'
const query = require('jelly-sql')
The library exports named exports; default import is not available.
jellySQL (global in browser)
const selector = jellySQL.query(`SELECT * FROM DOM`)
const selector = query(`SELECT * FROM DOM`)
When using CDN without a module bundler, the library exposes a global jellySQL object. Using the named import directly will fail.
type exports
import type { QueryFunction } from 'jelly-sql'
TypeScript types are included. There is no common mistake for type imports.

Demonstrates importing the query function and converting SQL-style queries to CSS selectors for DOM querying.

import { query } from 'jelly-sql'; // Get all anchor tags const selector1 = query(`SELECT * FROM DOM WHERE TAG = 'a'`); console.log(selector1); // Output: 'a' // Get elements with class 'active' inside a div const selector2 = query(`SELECT * FROM DOM WHERE TAG = 'div' AND .className = 'active'`); console.log(selector2); // Output: 'div.active' // Use the selector with querySelectorAll const elements = document.querySelectorAll(selector2);
Debug
Known issues
gotchaThe query function returns a CSS selector string, not the DOM elements directly. You must call document.querySelectorAll() yourself.
fix
Use query() to get the selector, then pass it to querySelectorAll().
affects: >=1.0.0
deprecatedThe global `jellySQL` object in CDN builds may not be available in future major versions. Prefer ESM imports.
fix
Use npm/yarn import instead of CDN global, or use the module version via <script type="module">.
affects: <=1.1.0
gotchaSQL keywords like SELECT, FROM, WHERE are case-insensitive, but tag names and attribute values are case-sensitive (matching CSS selector behavior).
fix
Ensure correct case for tag names and attribute values.
affects: >=1.0.0
Errors
Common errors & fixes
Error: query is not defined
Using `query()` directly without importing or when using CDN.
fix
If using CDN, use `jellySQL.query()`. If using npm, add `import { query } from 'jelly-sql';`.
TypeError: Cannot read properties of undefined (reading 'querySelectorAll')
Trying to call querySelectorAll on the result of query(), which is a string, not a DOM node.
fix
Use `document.querySelectorAll(selector)` where selector is the result of query().
Module not found: Error: Can't resolve 'jelly-sql'
Missing npm installation or incorrect import path.
fix
Run `npm install jelly-sql` and use `import { query } from 'jelly-sql';`.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
jelly-sql — npm install jelly-sql · libregistry