elements

prime dom library

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
elements
4360.6.09 years ago12 years agoMinified + gzip package size for elements in KB

Readme

elements
Build Status A minimal DOM Library built on top of prime.

Overview

```js // require elements var $ = require('elements'); // require elements utilities var ready = require('elements/domready'); var zen = require('elements/zen'); // do this on domready ready(function() { // create an element with css syntax var element = zen('div#someID.className'); // add text and insert into body element.text('read the documentation').insert(document.body); // add an event listener for click element.on('click', function() {
console.log('clicked!');
}); var document = $(document); // find the element in the dom, it's the same elements instance! if (document.find('div#someID.className') === element) {
console.log('success!');
} // delegate click, because delegation is best document.delegate('click', 'div#someID', function() {
console.log('delegation is nice');
}); // finally add a class name element.addClass('className2'); }); ``` When all else fails, read the full documentation.