Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix #1228 - tagName can be provided as a function.

  • Loading branch information...
commit 5fc8005c836394cd605cd2140c06defe3d1f48e0 1 parent e1e4257
@braddunbar braddunbar authored
Showing with 7 additions and 2 deletions.
  1. +1 −1  backbone.js
  2. +6 −1 test/view.js
View
2  backbone.js
@@ -1268,7 +1268,7 @@
var attrs = _.extend({}, getValue(this, 'attributes'));
if (this.id) attrs.id = this.id;
if (this.className) attrs['class'] = this.className;
- this.setElement(this.make(this.tagName, attrs), false);
+ this.setElement(this.make(getValue(this, 'tagName'), attrs), false);
} else {
this.setElement(this.el, false);
}
View
7 test/view.js
@@ -217,8 +217,13 @@ $(document).ready(function() {
test("Clone attributes object", function() {
var View = Backbone.View.extend({attributes: {foo: 'bar'}});
var v1 = new View({id: 'foo'});
- ok(v1.el.id === 'foo');
+ strictEqual(v1.el.id, 'foo');
var v2 = new View();
ok(!v2.el.id);
});
+
+ test("#1228 - tagName can be provided as a function", function() {
+ var View = Backbone.View.extend({tagName: function(){ return 'p'; }});
+ ok(new View().$el.is('p'));
+ });
});
Please sign in to comment.
Something went wrong with that request. Please try again.