From b8a7d7217d73c222ef1b3b9de9dbeac54af38b2e Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Mon, 9 Mar 2015 21:30:15 -0400 Subject: [PATCH] #476 fix conditional --- mithril.js | 2 +- tests/mithril-tests.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mithril.js b/mithril.js index ec7192ff..3458fef5 100644 --- a/mithril.js +++ b/mithril.js @@ -285,7 +285,7 @@ var m = (function app(window, undefined) { configs.push(callback(data, [node, !isNew, context, cached])) } } - else if (typeof dataType != FUNCTION) { + else if (typeof data != FUNCTION) { //handle text nodes var nodes; if (cached.nodes.length === 0) { diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index 7c57748d..a0f9d307 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -41,7 +41,7 @@ function testMithril(mock) { test(function() {return m("div", [1, 2, 3], [4, 5, 6, 7]).children[0].length === 3}) test(function() {return m("div", [1, 2, 3], [4, 5, 6, 7]).children[1].length === 4}) test(function() {return m("div", [1], [2], [3]).children.length === 3}) - + //m.module test(function() { mock.requestAnimationFrame.$resolve() @@ -853,6 +853,11 @@ function testMithril(mock) { ]) return root.childNodes.map(function(node) {return node.id}).join() == "div-1,div-3,div-2" }) + test(function() { + var root = mock.document.createElement("div") + m.render(root, m("div", function() {})) + return root.childNodes[0].childNodes.length == 0 + }) //end m.render //m.redraw