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
DOM Selector Library for IE9+
Install
$ npm install select-dom --save
Examples
var select = require('select-dom')
select('.foo a[href=bar]')
// => <Element>
select('.foo a[href=bar]', parentElement)
// => <Element>
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.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:
select.all('.foo a[href=bar]', select.all('.parents'));