[Pkg-javascript-commits] [backbone] 202/211: #426, better error message when events are missing.
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 17:00:25 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.5.0
in repository backbone.
commit 77caaed5d0c262b5c5d1ea6b6d0cd5e8cad171da
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date: Wed Jun 29 21:32:58 2011 -0400
#426, better error message when events are missing.
---
backbone.js | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/backbone.js b/backbone.js
index bc3047c..a6a8533 100644
--- a/backbone.js
+++ b/backbone.js
@@ -952,10 +952,11 @@
if (!(events || (events = this.events))) return;
$(this.el).unbind('.delegateEvents' + this.cid);
for (var key in events) {
- var methodName = events[key];
+ var method = this[events[key]];
+ if (!method) throw new Error('Event "' + events[key] + '" does not exist');
var match = key.match(eventSplitter);
var eventName = match[1], selector = match[2];
- var method = _.bind(this[methodName], this);
+ method = _.bind(method, this);
eventName += '.delegateEvents' + this.cid;
if (selector === '') {
$(this.el).bind(eventName, method);
@@ -1129,7 +1130,7 @@
// Throw an error when a URL is needed, and none is supplied.
var urlError = function() {
- throw new Error("A 'url' property or function must be specified");
+ throw new Error('A "url" property or function must be specified');
};
// Wrap an optional error callback with a fallback error event.
--
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