Skip to content

Commit

Permalink
Let make take other falsy values for content.
Browse files Browse the repository at this point in the history
  • Loading branch information
r00k committed Mar 21, 2012
1 parent 69d2c50 commit c7034b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
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 !== undefined) $(el).html(content);
if (content != null) $(el).html(content);
return el;
},

Expand Down
5 changes: 4 additions & 1 deletion test/view.js
Expand Up @@ -33,9 +33,12 @@ $(document).ready(function() {
equal($(div).text(), 'one two three');
});

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

var div = view.make('div', {id: 'test-div'}, '');
equal($(div).text(), '');
});

test("View: initialize", function() {
Expand Down

0 comments on commit c7034b9

Please sign in to comment.