0.3.0 • Published 13 years ago
by-shim v0.3.0
by
Select elements by class or id or tag
Example
Because document.getElementsByClassName is simply too verbose.
Also these functions return arrays! You can also pass an optional first parameter to give it a different context then document.
var byClass = require("by/class")
, queryAll = require("by/queryAll")
var elems = byClass("some-class")
var other = queryAll(elems[0], ".some div.selector")Also has
var byName = require("by/name")which is short fordocument.getElementsByNamevar byId = require("by/id")which is short fordocument.getElementByIdvar query = require("by/query")which is short fordocument.querySelectorvar queryAll = require("by/queryAll")which is short fordocument.querySelectorAllvar byTag = require("by/tag")which is short fordocument.getElementsByTagName
Installation
npm install by
Contributors
- Raynos
MIT Licenced
0.3.0
13 years ago

