Skip to content

eugene-eeo/nut.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nut.js

Modern 'selector engine'.

  • Comes in at ~0.3kB minified
  • Uses querySelectorAll and friends
  • Returns Arrays - abuse ES5 array methods
  • Optimises query methods
  • Support for contexts

Works great with evee.js. If you don't have to play along with other selector libraries you can alias the nut global to $.

Usage

<script src='/path/to/nut.js'></script>
$ = nut;
$('span.octicon')
  .map(/**/)
  .filter(/**/)
  .reduce(/**/);

// optimisations
$('.klass')    // getElementsByClassName
$.el('#id')    // getElementById

// context
$('query', element);
$('query', '#nut');
$('query', $.el('#nut'));

Installation

$ bower install eugene-eeo/nut.js