[Pkg-javascript-commits] [backbone] 22/28: fixes #244 -- allow View#events to be defined as a function, making it easier to call super.
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 17:01:26 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.5.3
in repository backbone.
commit 6bb43c1b81c3890548baa23dfefbc7859105e698
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date: Wed Aug 3 16:41:49 2011 -0400
fixes #244 -- allow View#events to be defined as a function, making it easier to call super.
---
backbone.js | 1 +
test/view.js | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/backbone.js b/backbone.js
index 92f74b8..df6f538 100644
--- a/backbone.js
+++ b/backbone.js
@@ -949,6 +949,7 @@
// not `change`, `submit`, and `reset` in Internet Explorer.
delegateEvents : function(events) {
if (!(events || (events = this.events))) return;
+ if (_.isFunction(events)) events = events.call(this);
$(this.el).unbind('.delegateEvents' + this.cid);
for (var key in events) {
var method = this[events[key]];
diff --git a/test/view.js b/test/view.js
index 1d52d52..1f007c2 100644
--- a/test/view.js
+++ b/test/view.js
@@ -118,8 +118,8 @@ $(document).ready(function() {
var count = 0;
var ViewClass = Backbone.View.extend({
el: $('body'),
- events: {
- "fake$event.namespaced": "run"
+ events: function() {
+ return {"fake$event.namespaced": "run"};
},
run: function() {
count++;
--
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