From c7034b97356f67dbeede653595580775fa6d40e0 Mon Sep 17 00:00:00 2001 From: Ben Orenstein Date: Wed, 21 Mar 2012 17:21:16 -0400 Subject: [PATCH] Let make take other falsy values for content. --- backbone.js | 2 +- test/view.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) 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() {