Skip to content

jqrony/quanter

Repository files navigation

Quanter npm version

A Pure-JavaScript, CSS selector engine designed to be easily select DOM-Elements.

license author downloads jsDelivr Hits downloads month

How to install Quanter

To include Quanter in Node, first install with npm.

npm install quanter

How to build Quanter

Clone a copy of the main Sizzle git repo by running:

git clone git://github.com/jqrony/quanter.git

In the quanter/dist folder you will find build version of sizzle along with the minified copy and associated map file.

Including Quanter

Below are some of the most common ways to include Quanter.

Browser

<script src="https://cdn.jsdelivr.net/npm/quanter@4.0.0/dist/quanter.min.js"></script>

Webpack / Browserify / Babel

There are several ways to use Webpack, Browserify or Babel. For more information on using these tools, please refer to the corresponding project's documentation. In the script, including Quanter will usually look like this:

import quanter from "quanter";

Features

Multi Selector

The Quanter method allows for flexible element selection using a wide range of selector types:

  • CSS Selectors
    Supports tag names, class selectors (.class), ID selectors (#id), attribute selectors ([attr=value]), and pseudo-classes (like :nth-child, :first-of-type, etc.).

  • ⚠️ Limited XPath Support
    Basic XPath expressions are supported, but with limited syntax recognition. Use only for simple XPath needs.

Best Use: When your use case involves a mix of CSS-style selectors and simple XPath, and you want to avoid switching methods.

Signature and Parameters

Quanter.XPathSelect(String expr, DOMNode context, Array results, Array seed);
  • selector [required] A CSS Selector or XPath Expression (comma separated or non-comma separated)
  • context [optional] An element, document, or document fragment to use as the context for finding elements.
  • results [optional] An optional array to which the matched elements will be added.
  • seed [optional] A set of elements to match against

Learn for more documentation

XPath Selector

The XPathSelect method is a specialized function built to handle full XPath syntax, offering complete support for:

  • Complex queries
  • Nested expressions
  • Axes like following-sibling, ancestor, descendant
  • Functions like contains(), starts-with(), text(), etc.

Best Use: When your use case requires powerful and deeply nested element queries using the full capabilities of XPath.

Signature and Parameters

Quanter.XPathSelect(String expr, DOMNode context, Array results, Array seed);
  • expr[required] A XPath Expression (comma separated or non-comma separated)
  • context [optional] An element, document, or document fragment to use as the context for finding elements.
  • results [optional] An optional array to which the matched elements will be added.
  • seed [optional] A set of elements to match against

Learn for more documentation

About

A pure-Javascript, Advance CSS Selector Engine

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 17