Permalink
Browse files

Let make take other falsy values for content.

  • Loading branch information...
1 parent 69d2c50 commit c7034b97356f67dbeede653595580775fa6d40e0 @r00k committed Mar 21, 2012
Showing with 5 additions and 2 deletions.
  1. +1 −1 backbone.js
  2. +4 −1 test/view.js
View
@@ -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;
},
View
@@ -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() {

0 comments on commit c7034b9

Please sign in to comment.