arturadib / agility

Javascript MVC for the "write less, do more" programmer
http://agilityjs.com
MIT License
542 stars 70 forks source link

can't put empty string on a 'div' with 'data-bind' #53

Closed quartzo closed 13 years ago

quartzo commented 13 years ago

This code doesn't change the DOM:

// Bind model to element's HTML content
var message = $$({txt:"I'm text from a model"}, '<div data-bind="txt"/>');
$$.document.append(message);
message.model.set({'txt':''});

Simplest correction:

@@ -582,7 +582,7 @@
                 if (self.model.get(bindData.key)) {
                   $node.text(self.model.get(bindData.key).toString());
                 } else {
-                  $node.text( null );
+                  $node.text('');
                 }
               });
             }
tristanls commented 13 years ago

Thanks @quartzo. Submitted the fix in #54