-
-
Notifications
You must be signed in to change notification settings - Fork 21
Home
Project Home Page | Source Repository | Learn Quanter | Includes Features
Quanter library includes all types of selectors. This will prove to be a good useful library for your web applications and projects.
Quanter library does a lot with less code. It shortens the code used in your projects or web applications. Due to which the performance of your webapp or projects will remain good. It selects advanced and complicated selectors of DOM elements very easily and in less code. This will save you coding time and writing more code.
-
:get/:postForm elements with the specified methodgetorpost -
:requiredInput required elements. -
:read-onlyInput readOnly elements. -
:valid/:invalidInput valid field elements. / Input invalid field elements. -
:optionalElement that does not have therequiredattribute set on it. -
:writableWritable none-readonly/none-disabled Input elements -
:inputInput elements -
:indeterminateMatches form controls (e.g., checkboxes) in an indeterminate state. -
:openMatches elements like<details>/<dialog>that are currently open. -
:out-of-rangeMatches input elements whose value is outside the allowed range. -
:in-rangeMatches input elements whose value is within the allowed range. -
:linkMatches<a>or<area>elements with an unvisited hyperlink. -
:modalMatches elements (like dialogs) that are displayed as modal dialogs. -
:pausedMatches media elements (e.g., ) that are currently paused. -
:mutedMatches media elements that are muted. -
:autoplayMatches media elements that are set to autoplay. -
:picture-in-pictureMatches video elements that are in picture-in-picture mode. -
:popover-openMatches elements with thepopoverattribute that are currently shown. -
:fullscreenMatches the element that is currently in fullscreen mode. -
:playingMatches media elements that are currently playing. -
:definedMatches custom elements that have been defined withcustomElements.define(). -
:dirMatches elements based on text direction: e.g.,:dir(ltr)or:dir(rtl). -
:defaultInput default checked or option default selected elements. -
:buttonInput elements that arebuttonsor have type "button" -
:checkbox,:file,:image,:password,:radio,:reset,:submit,:text,:search,:range,:url,:color,:email,:numberInput elements with the specified type.
-
:first/:lastThe first/last matching element -
:eq/:nthThe nth element; e.g.:eq(6)finds the 7th element -
:lt/:gtElements at positions above/below the specified position -
:odd/:evenEven/odd-numbered elements -
:fixedMatching position:fixed element
-
:importmap/:ecmascriptThe type="ecmascript|importmap" script element -
:jsonScript elements with typeapplication/json -
:moduleScript elements with typemodule
-
:themeAll theme-color or address-bar color-theme meta elements. -
:viewportMeta viewport element.<meta name="viewport" content="width=device-width, initial-scale=1.0">
-
:contains(TEXT)Elements with textContent containing the word 'TEXT'. Case-sensitive. -
:rcontains(REGEX)Elements with textContent containing the word '/(?:foo|bar)/' Regular-expression. -
:icontains(TEXT)Elements with textContent containing the word 'TEXT'. Case-insensitive. -
:ircontains(REGEX)Elements with textContent containing the word '/(?:foo|bar)/' Regular-expression Case-insensitive.
-
:nth-last-of-type(n)The pattern for matching elements, counting from the end. -
:first-childThe first matching element among a group of sibling elements. -
:first-of-typeThe first element of its typee among a group of sibling elements. -
:last-childThe last matching element among a group of sibling elements. -
:last-of-typeThe last element of its typee among a group of sibling elements. -
:nth-child(n)Takes a single argument that describes a pattern for matching element indices in a list of siblings. -
:only-of-typeThe represents an element that has no siblings of the same type. -
:nth-of-type(n)The matches elements based on their position among siblings of the same type (tag name). -
:nth-last-child(n)The matches elements based on their position among a group of siblings, counting from the end. -
:only-childThe represents an element without any siblings.:first-child:last-childor:nth-child(1):nth-last-child(1), but with a lower specificity.
-
:parentElements with at least one child node (either text or an element). -
:emptyThe:emptyrepresents any element that has no children. -
:not(h1)Selects elements that do not match the given selector inside the:not(...). -
:lang(en)Selects all elements that match the specified language code. -
:targetElementidmatching from origin #hash -
:focusFocusable focused elements. -
:checkedInput checked elements or select in option selected elements. -
:enabled/:disabledTheenabledSelect none-disabled Elements. anddisabledSelect disabled Elements. -
:rootRoot elementshtml -
:selected(option) elements that are currently selected -
:linkA proper valid anchor Elements with none-emptyhref -
:filter(h2)Filter matched element of given elements list. -
:where(h2, h3)Similar to:is(...), but has no specificity weight. -
:has(input)Selects elements that contain an<input>element inside them. -
:visible/:hiddenhidden or visible elements. Support (visibility, hidden, display) -
:headerHeader elements (h1, h2, h3, h4, h5, h6). -
:animatedElements that haveCSSanimation. -
:offsetnone-static position elements. -
:editableContaining thecontenteditable=trueattribute. -
:activeFocused or active Elements. -
:inlineInline elements (img, input, meta, area...) etc. -
:xpath(expr)Select elements using from XPath expression. :role(button)-
:charset(utf-8)Selects all elements that match the specified charset code. (Unavailable 🚫)
-
<The child selector selects all elements that are the parent of a specified element. -
>The child selector selects all elements that are the children of a specified element. -
+The adjacent sibling selector is used to select an element that is directly after another specific element. -
~The general sibling selector selects all elements that are next siblings of a specified element. -
The descendant selector matches all elements that are descendants of a specified element.
How to use and configure Quanter public API
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.
Quanter(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
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.
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