Permalink
Browse files

Merge pull request #1048 from marat-dreizin/master

Added ability to avoid an additional '$()' call in 'setElement' method if current 'element' is already wrapped with '$()'
  • Loading branch information...
2 parents c9599d6 + 0d1d278 commit b37a09662e5fe51ec5330740a51e5fdc0729861e @jashkenas jashkenas committed Feb 27, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 backbone.js
View
@@ -1131,7 +1131,7 @@
// Change the view's element (`this.el` property), including event
// re-delegation.
setElement: function(element, delegate) {
- this.$el = $(element);
+ this.$el = (element instanceof $) ? element : $(element);
this.el = this.$el[0];
if (delegate !== false) this.delegateEvents();
return this;

0 comments on commit b37a096

Please sign in to comment.