From cdce2ec30f93e85c2c48cfa0bd93b85ee8769254 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Tue, 17 Jan 2012 14:17:02 -0500 Subject: [PATCH] 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 e846647a..cc520aae 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(); },