rkgttr-q
v0.0.7
Published
DOM selector shortcuts.
Downloads
2
Maintainers
Readme
rkgttr-q
DOM elements selector shortcuts.
How to Install
$ npm install rkgttr-q --save-dev
or
$ yarn add rkgttr-q --dev
Getting Started
Q is a module that consists of shortcuts to select DOM elements. For example instead of typing document.querySelectorAll('selector')
you just have to type Q.all('selector')
. Following is the list of Q methods:
one
: shortcut fordocument.querySelector
all
: shortcut fordocument.querySelectorAll
id
: shortcut fordocument.getElementById
classname
: shortcut fordocument.getElementsByClassName
tag
: shortcut fordocument.getElementsByTagName
All methods, except Q.id
can have a second optional parameters, which should be a Node
object, that is the context from where you want to perform the query. For example:
import * as Q from 'rkgttr-q';
Q.all('li'); // return all list elements in the document
Q.all('li', Q.one('ul.todo')); // return all list elements into the .todo list
License
MIT © 2016 Erik Guittiere