Package Exports
- select-dom
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (select-dom) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
select-dom

Lightweight
querySelector
/All
wrapper that outputs an Array
Install
$ npm install select-dom
Examples
var select = require('select-dom')
/**
* select()
*/
select('.foo a[href=bar]')
// => <Element>
select('.foo a[href=bar]', parentElement)
// => <Element>
/**
* select.exists()
*/
select.exists('.foo a[href=bar]')
// => true/false
select.exists('.foo a[href=bar]', parentElement)
// => true/false
/**
* select.all()
*/
select.all('.foo a[href=bar]')
// => [<Element>, <Element>, <Element>]
select.all('.foo a[href=bar]', parentElement)
// => [<Element>, <Element>, <Element>]
select.all('.foo a[href=bar]', [parentElement1, parentElement2])
// => [<Element>, <Element>, <Element>]
API
select(selector[, parent = document])
Maps to parent.querySelector(selector)
select.exists(selector[, parent = document])
Tests the existence of one or more elements matching the selector.
select.all(selector[, parents = document])
Maps to parents.querySelectorAll(selector)
plus:
- it always returns an array
- parents can be undefined, an element, an array of elements, or NodeList
Essentially now you can do something like:
const parents = select.all('.parents');
if(checkSomething(parents)) {
select.all('.foo a[href=bar]', parents);
}