elements
prime dom library
$ cnpm install elements 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 0.6.0                                ...           latest (5 years ago)

18 Versions

  • 0.6.0                                ...           5 years ago
  • 0.5.0                                ...           6 years ago
  • 0.4.3                                ...           6 years ago
  • 0.4.2                                ...           6 years ago
  • 0.4.1                                ...           6 years ago
  • 0.4.0                                ...           6 years ago
  • 0.3.1                                ...           6 years ago
  • 0.3.0                                ...           6 years ago
  • 0.2.4                                ...           7 years ago
  • 0.2.3                                ...           7 years ago
  • 0.2.2                                ...           7 years ago
  • 0.2.1                                ...           7 years ago
  • 0.2.0                                ...           7 years ago
  • 0.1.0                                ...           8 years ago
  • 0.0.9                                ...           8 years ago
  • 0.0.8                                ...           8 years ago
  • 0.0.7-alpha                                ...           8 years ago
  • 0.0.6-alpha                                ...           8 years ago
Downloads
Today 0
This Week 5
This Month 5
Last Day 0
Last Week 1
Last Month 28
Dependencies (3)
Dev Dependencies (5)

Copyright 2014 - 2016 © taobao.org |