Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

elements

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elements

prime dom library

  • 0.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
670
increased by81.08%
Maintainers
3
Weekly downloads
 
Created
Source

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.

Keywords

FAQs

Package last updated on 04 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc