dumb-query-selector

WebJar for dumb-query-selector

License

License

GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

dumb-query-selector
Last Version

Last Version

3.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

dumb-query-selector
WebJar for dumb-query-selector
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/ultraq/dumb-query-selector

Download dumb-query-selector

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/dumb-query-selector/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>dumb-query-selector</artifactId>
    <version>3.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/dumb-query-selector/
implementation 'org.webjars.npm:dumb-query-selector:3.3.0'
// https://jarcasting.com/artifacts/org.webjars.npm/dumb-query-selector/
implementation ("org.webjars.npm:dumb-query-selector:3.3.0")
'org.webjars.npm:dumb-query-selector:jar:3.3.0'
<dependency org="org.webjars.npm" name="dumb-query-selector" rev="3.3.0">
  <artifact name="dumb-query-selector" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='dumb-query-selector', version='3.3.0')
)
libraryDependencies += "org.webjars.npm" % "dumb-query-selector" % "3.3.0"
[org.webjars.npm/dumb-query-selector "3.3.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Dumb Query Selector

Build Status Coverage Status npm

Shortcuts to the querySelector(All) functions, the (All) instead returning an array of nodes (because NodeLists are dumb).

Installation

Via Bower:

bower install dumb-query-selector --save

Via NPM:

npm install dumb-query-selector --save

Since this project is only 1 script, you can also download the script to your project if you prefer: dumb-query-selector.js.

Usage

This project exports 2 functions via UMD, $ and $$, and is available to you through a variety of different module loaders. If used in the browser outside of a module environment, then both functions are available globally.

The first, $, returns a single node, whereas $$ returns an array of nodes.

import {$, $$} from 'dumb-query-selector';

// Return matching element, use it directly
let result = $('#some-id');
let blah = result.getAttribute('data-blah');

// Return array of matching elements, allowing the use of array functions
let results = $$('.some-classes');
results.forEach(result => {
  // ...
});

Both functions take up to 2 arguments:

  • query Type: String
    A standard CSS selector.

  • scope Type: Node
    Optional context on which to invoke the function. Defaults to document if not specified.

Versions

Version
3.3.0