mithril.js: fix if clause that expects truthy value. issue: #689

When key=0 the if statement doesn't do what is intended.
This commit is contained in:
pelonpelon 2015-06-25 18:25:49 -05:00
parent 505d7b930d
commit 72b705b918

View file

@ -248,7 +248,7 @@ var m = (function app(window, undefined) {
var key = data && data.attrs && data.attrs.key;
data = (pendingRequests == 0 || forcing) || (cached && cached.controllers && cached.controllers.indexOf(controller) > -1) ? data.view(controller) : {tag: "placeholder"};
if (data.subtree === "retain") return cached;
if (key) {
if (typeof key !== 'undefined' && key !== null) {
if (!data.attrs) data.attrs = {};
data.attrs.key = key;
}