A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/dperini/nwmatcher below:

dperini/nwmatcher: Fast Javascript CSS Selector Engine and Matcher

A fast CSS selector engine and matcher.

To include NWMatcher in a standard web page:

<script type="text/javascript" src="nwmatcher.js"></script>

To use it with Node.js:

NWMatcher currently supports browsers (as a global, NW.Dom) and headless environments (as a CommonJS module).

Here is a list of all the CSS2/CSS3 Supported selectors.

You can read more about NWMatcher features and compliance on the wiki.

first( selector, context )

Returns a reference to the first element matching selector, starting at context.

match( element, selector, context )

Returns true if element matches selector, starting at context; returns false otherwise.

select( selector, context, callback )

Returns an array of all the elements matching selector, starting at context. If callback is provided, it is invoked for each matching element.

Returns a reference to the first element with ID id, optionally filtered to descendants of the element from.

Returns an array of elements having the specified tag name tag, optionally filtered to descendants of the element from.

Returns an array of elements having the specified class name class, optionally filtered to descendants of the element from.

Returns an array of elements having the specified value name for their name attribute, optionally filtered to descendants of the element from.

getAttribute( element, attribute )

Return the value read from the attribute of element with name attribute, as a string.

hasAttribute( element, attribute )

Returns true element has an attribute with name attribute set; returns false otherwise.

The following is the list of currently available configuration options, their default values and descriptions, they are boolean flags that can be set to true or false:

Example:

NW.Dom.configure( { USE_QSAPI: false, VERBOSITY: false } );
registerOperator( symbol, resolver )

Registers a new symbol and its matching resolver in the operators table. Example:

NW.Dom.registerOperator( '!=', 'n!="%m"' );
registerSelector( name, rexp, func )

Registers a new selector, with the matching regular expression and the appropriate resolver function, in the selectors table.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4