0.7.2 • Published 7 years ago

domd v0.7.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

DOMD

Tiny dependency free DOM delegator.

Installation

Use npm package manager to install the DOM delegator

npm install domd

Usage

Follow the example:

<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <button class="js-button">Click me</button>
</body>
</html>
var domd = require('domd');
var d = domd(document.body);

d.on('click', '.js-button', function(ev, el) {
  console.log('Button clicked!');
});

Methods

on(event, selector, callback, use_capture)

Bind new listener to all elements.

  • event - javascript event to catch (click, keyup and etc)
  • selector - valid document query selector
  • callback - function to callback. Arguments: event, element You can return false from callback to preventDefault and stop next handler searching.
  • use_capture - use capture or not, default false

off(event, selector)

Disable listeners from all elements using selector.

  • event - javascript event
  • selector - valid document query selector
0.7.2

7 years ago

0.7.1

8 years ago

0.7.0

8 years ago

0.5.5

8 years ago

0.5.4

8 years ago

0.5.3

8 years ago

0.5.2

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.3

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago