rkgttr-q

0.0.7 • Public • Published

rkgttr-q

NPM version NPM downloads Build Status Coverage Status Dependency Status

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 for document.querySelector
  • all: shortcut for document.querySelectorAll
  • id: shortcut for document.getElementById
  • classname: shortcut for document.getElementsByClassName
  • tag: shortcut for document.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

/rkgttr-q/

    Package Sidebar

    Install

    npm i rkgttr-q

    Weekly Downloads

    2

    Version

    0.0.7

    License

    MIT

    Last publish

    Collaborators

    • rkgttr