Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow view.el to be provided as a function. #1693

Merged
merged 1 commit into from
Oct 2, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Allow view.el to be provided as a function.
  • Loading branch information
braddunbar committed Oct 1, 2012
commit e2d54836167cb94f3784d67423c8046c8679aa48
2 changes: 1 addition & 1 deletion backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@
if (this.className) attrs['class'] = _.result(this, 'className');
this.setElement(this.make(_.result(this, 'tagName'), attrs), false);
} else {
this.setElement(this.el, false);
this.setElement(_.result(this, 'el'), false);
}
}

Expand Down
11 changes: 11 additions & 0 deletions test/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,15 @@ $(document).ready(function() {
view.remove();
});

test("Provide function for el.", 1, function() {
var View = Backbone.View.extend({
el: function() {
return "<p><a></a></p>";
}
});

var view = new View;
ok(view.$el.is('p:has(a)'));
});

});