[Pkg-javascript-commits] [backbone] 179/281: removing overzealous events setting API.
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 17:02:10 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.9.0
in repository backbone.
commit 93cb997fc3177e1807ec9c2468a599773937997d
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date: Thu Jan 12 16:37:18 2012 -0500
removing overzealous events setting API.
---
backbone.js | 10 +---------
test/view.js | 17 -----------------
2 files changed, 1 insertion(+), 26 deletions(-)
diff --git a/backbone.js b/backbone.js
index ba3b244..6c8dcf8 100644
--- a/backbone.js
+++ b/backbone.js
@@ -922,7 +922,7 @@
// {
// 'mousedown .title': 'edit',
// 'click .button': 'save'
- // 'click a': function (evnt) { ... }
+ // 'click .open': function(e) { ... }
// }
//
// pairs. Callbacks will be bound to the view, with `this` set properly.
@@ -930,16 +930,8 @@
// Omitting the selector binds the event to `this.el`.
// This only works for delegate-able events: not `focus`, `blur`, and
// not `change`, `submit`, and `reset` in Internet Explorer.
- //
- // A function may also be returned:
- // function() {
- // return {
- // 'mousedown .title': this.titleMouseDown
- // };
- // }
delegateEvents : function(events) {
if (!(events || (events = getValue(this, 'events')))) return;
- if (_.isFunction(events)) events = _.bind(events, this)();
this.undelegateEvents();
for (var key in events) {
var method = events[key];
diff --git a/test/view.js b/test/view.js
index aeb7817..aa96649 100644
--- a/test/view.js
+++ b/test/view.js
@@ -70,23 +70,6 @@ $(document).ready(function() {
equals(view.counter, 3);
});
- test("View: delegateEvents allows function as events arg", function() {
- view.counter = 0;
- view.el = "#qunit-banner";
- var events = function () {
- return {"click": this.click};
- };
- view.click = function() { this.counter++; };
- view.delegateEvents(events);
- $('#qunit-banner').trigger('click');
- equals(view.counter, 1);
- $('#qunit-banner').trigger('click');
- equals(view.counter, 2);
- view.delegateEvents(events);
- $('#qunit-banner').trigger('click');
- equals(view.counter, 3);
- });
-
test("View: undelegateEvents", function() {
var counter = counter2 = 0;
view.el = document.body;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git
More information about the Pkg-javascript-commits
mailing list