Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.
/ yocto Public archive

chainable all the default DOM Element methods and properties

License

Notifications You must be signed in to change notification settings

deepsweet/yocto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yocto Build Status

yocto is fun, small (min.js ≈1K and min.js.gz ≈ 600B) and experimental library which allows you to chain all the default DOM Element methods and properties like this:

$$$('div')
    .style({background: 'red', color: '#fff'})
    .setAttribute('data-test', 2)
    .addEventListener('click', function(e) { console.log(e) })
    .lastElementChild()
        .className('last-child')
        .querySelectorAll('span')
            .style({color: '#0f0'})
            .innerHTML()

that's 137 items in the latest Google Chrome, for example.

console.dir($$$.prototype)

additional features

$$$('body') instanceof Array
// true

$$$ can:

  • handle all the same selectors as querySelectorAll
  • create element with $$$('<div/>')
  • wrap single element with $$$(document.body)
  • wrap elements collectons like NodeList and any other Array-Like objects with $$$(document.body.childNodes)

cross-browser normalization

fuck it.

test & lint

  • all: npm test
  • unit (still in progress): open test/test.html in your browser or run npm run-script unit for testing with PhantomJS
  • eslint: npm run-script eslint
  • jscs: npm run-script jscs

license

WFTPL

About

chainable all the default DOM Element methods and properties

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published