Skip to content

Commit

Permalink
Allow make to take an argument of 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
r00k committed Mar 21, 2012
1 parent f784ae3 commit 69d2c50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backbone.js
Expand Up @@ -1192,7 +1192,7 @@
make: function(tagName, attributes, content) {
var el = document.createElement(tagName);
if (attributes) $(el).attr(attributes);
if (content) $(el).html(content);
if (content !== undefined) $(el).html(content);
return el;
},

Expand Down
5 changes: 5 additions & 0 deletions test/view.js
Expand Up @@ -33,6 +33,11 @@ $(document).ready(function() {
equal($(div).text(), 'one two three');
});

test("View: make can take an argument of 0", function() {
var div = view.make('div', {id: 'test-div'}, 0);
equal($(div).text(), '0');
});

test("View: initialize", function() {
var View = Backbone.View.extend({
initialize: function() {
Expand Down

0 comments on commit 69d2c50

Please sign in to comment.