[Pkg-javascript-commits] [backbone] 218/281: DRY-ing up setElement() a bit.

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 17:02:15 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 cdce2ec30f93e85c2c48cfa0bd93b85ee8769254
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Tue Jan 17 14:17:02 2012 -0500

    DRY-ing up setElement() a bit.
---
 backbone.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/backbone.js b/backbone.js
index e846647..cc520aa 100644
--- a/backbone.js
+++ b/backbone.js
@@ -302,7 +302,7 @@
       }
 
       options = options ? _.clone(options) : {};
-      if (!this.set(attrs, options)) return false;
+      if (attrs && !this.set(attrs, options)) return false;
       var model = this;
       var success = options.success;
       options.success = function(resp, status, xhr) {
@@ -980,9 +980,8 @@
     },
 
     setElement : function(element, delegate) {
-      if (_.isString(element)) element = $(element)[0];
-      this.el = element;
       this.$el = $(element);
+      this.el = this.$el[0];
       if (delegate !== false) this.delegateEvents();
     },
 

-- 
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