diff --git a/backbone.js b/backbone.js index c896ba94..54d9db65 100644 --- a/backbone.js +++ b/backbone.js @@ -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; }, diff --git a/test/view.js b/test/view.js index cb924a09..eda89b23 100644 --- a/test/view.js +++ b/test/view.js @@ -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() {