dom-delegate
Advanced tools
Comparing version 0.1.5 to 0.2.0
@@ -45,4 +45,4 @@ /*global buster, assert, refute, Delegate*/ | ||
delegate.on('click mouseover', '#delegate-test-clickable', spyA); | ||
delegate.on('click mouseover', '#delegate-test-clickable', spyB); | ||
delegate.on('click', '#delegate-test-clickable', spyA); | ||
delegate.on('click', '#delegate-test-clickable', spyB); | ||
@@ -68,3 +68,3 @@ var element = document.getElementById("delegate-test-clickable"); | ||
spy = this.spy(); | ||
delegate.on('click mouseover', '#delegate-test-clickable', spy); | ||
delegate.on('click', '#delegate-test-clickable', spy); | ||
@@ -83,3 +83,3 @@ element = document.getElementById('delegate-test-clickable'); | ||
spy = this.spy(); | ||
delegate.on('click mouseover', '#delegate-test-clickable', spy); | ||
delegate.on('click', '#delegate-test-clickable', spy); | ||
@@ -234,4 +234,4 @@ delegate.destroy(); | ||
delegate.on('click mouseover', '#delegate-test-clickable', spyA); | ||
delegate.on('click mouseover', '#another-delegate-test-clickable', spyB); | ||
delegate.on('click', '#delegate-test-clickable', spyA); | ||
delegate.on('click', '#another-delegate-test-clickable', spyB); | ||
@@ -238,0 +238,0 @@ delegate.off(); |
{ | ||
"name": "dom-delegate", | ||
"description": "Create and manage a DOM event delegator.", | ||
"version": "0.1.5", | ||
"version": "0.2.0", | ||
"main": "lib/delegate.js", | ||
@@ -6,0 +6,0 @@ "scripts": [ |
@@ -135,3 +135,3 @@ /*jslint browser:true, node:true*/ | ||
Delegate.prototype.on = function(eventType, selector, handler, eventData) { | ||
var root, listenerMap, matcher, matcherParam, self = this, /** @const */ SEPARATOR = ' '; | ||
var root, listenerMap, matcher, matcherParam, self = this; | ||
@@ -142,11 +142,2 @@ if (!eventType) { | ||
// Support a separated list of event types | ||
if (eventType.indexOf(SEPARATOR) !== -1) { | ||
eventType.split(SEPARATOR).forEach(function(singleEventType) { | ||
self.on(singleEventType, selector, handler, eventData); | ||
}); | ||
return this; | ||
} | ||
// Normalise undefined eventData to null | ||
@@ -225,3 +216,3 @@ if (eventData === undefined) { | ||
Delegate.prototype.off = function(eventType, selector, handler) { | ||
var i, listener, listenerMap, listenerList, singleEventType, self = this, /** @const */ SEPARATOR = ' '; | ||
var i, listener, listenerMap, listenerList, singleEventType, self = this; | ||
@@ -244,11 +235,2 @@ listenerMap = this.listenerMap; | ||
// Support a separated list of event types | ||
if (eventType.indexOf(SEPARATOR) !== -1) { | ||
eventType.split(SEPARATOR).forEach(function(singleEventType) { | ||
self.off(singleEventType, selector, handler); | ||
}); | ||
return this; | ||
} | ||
// Remove only parameter matches if specified | ||
@@ -255,0 +237,0 @@ for (i = listenerList.length - 1; i >= 0; i--) { |
{ | ||
"name": "dom-delegate", | ||
"version": "0.1.5", | ||
"version": "0.2.0", | ||
"author": "FT Labs <enquiries@labs.ft.com> (http://labs.ft.com/)", | ||
@@ -8,3 +8,4 @@ "description": "Create and manage a DOM event delegator.", | ||
"Matthew Caruana Galizia", | ||
"Sam Giles" | ||
"Sam Giles", | ||
"Matt Andrews" | ||
], | ||
@@ -11,0 +12,0 @@ "main": "lib/delegate.js", |
# Delegate # | ||
[![Build Status](https://travis-ci.org/ftlabs/delegate.png?branch=master)](https://travis-ci.org/ftlabs/delegate) | ||
[![Build Status](https://travis-ci.org/ftlabs/dom-delegate.png?branch=master)](https://travis-ci.org/ftlabs/dom-delegate) | ||
@@ -45,2 +45,4 @@ Delegate is a simple, easy-to-use component for binding to events on all target elements matching the given selector, irrespective of whether they exist at registration time or not. This allows developers to implement the [event delegation pattern](http://www.sitepoint.com/javascript-event-delegation-is-easier-than-you-think/). | ||
Also note: as of 0.2.0 you cannot specify more than one `eventType` in a single call to `off` or `on`. | ||
### Google Closure Compiler ### | ||
@@ -93,3 +95,3 @@ | ||
Space-separated list of events to listen for e.g. `mousedown mouseup mouseout` or `click`. | ||
The event to listen for e.g. `mousedown`, `mouseup`, `mouseout`, `error` or `click`. | ||
@@ -116,3 +118,3 @@ #### `selector (string)` #### | ||
Remove handlers for events matching these types, in a space-separated list, considering the other parameters. | ||
Remove handlers for events matching this type considering the other parameters. | ||
@@ -119,0 +121,0 @@ #### `selector (string)` #### |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
141
32017
746