ele

elements

A minimal DOM library built on top of prime

Showing:

Popularity

Downloads/wk

92

GitHub Stars

43

Maintenance

Last Commit

6yrs ago

Contributors

9

Package

Dependencies

3

Size (min+gzip)

8.7KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

elements

Build Status

A minimal DOM Library built on top of prime.

Overview

// 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.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100