dom-query

1.0.1 • Public • Published

dom-query

Build Status

DOM query selector based on document.querySelector with fallback engine support.

API

query(selector, [element])

Query selector against the document or element and return a single match.

query('ul > li');
query('ul > li', root);

If selector is a dom element, it is returned right away.

query.all(selector, [element])

Query selector against the document or element and return an array of all matches.

query.all('ul > li');
query.all('ul > li', root);

If selector is a dom element or a NodeList, it is returned and wrapped inside an array.

Fallback engines

To allow some fallback engine (for compatibility support) you can set it up with the following:

query.engine({
  one: function(selector, element) {} // the one fall back engine
  all: function(selector, element) {} // the all fall back engine
});

Acknowledgement

This module has been built on top of component-query.

Readme

Keywords

none

Package Sidebar

Install

npm i dom-query

Weekly Downloads

27

Version

1.0.1

License

none

Last publish

Collaborators

  • jails