domy-element
Html or css selector into DOM elements. For use with Browserify.
Part of the Domy module collection.
Install
npm install domy-element --save
Usage
var element = ; var el = ; // singlevar els = all; // multiple var el = ;var el = ; // In contextvar items = all'.items';
Element
element(data);
data
- a string, css selector, or DOM element- Example 1:
element('<div class="item"></div>').one()
- returns a DOM element with a class of item - Example 2:
element(document.body).one()
- returns the body DOM element - Example 3:
element('body').one()
- returns the body DOM element
- Example 1:
Instance Methods
all([selector])
Returns an array of DOM elements
selector
- css selector. If used,selector
will select all DOM elements within the context of the parent selector used in theelement()
method.
one([selector])
Returns a single DOM element
selector
- css selector. If used,selector
will select the first matching DOM elements within the context of the parent selector used in theelement()
method.
Run Tests
Requires Phantomjs is installed
npm install
npm test