From 96b1f9e79113a6825498c2fd0c1af34dee7b38eb Mon Sep 17 00:00:00 2001 From: webcss Date: Sat, 7 Feb 2015 00:18:07 +0100 Subject: [PATCH] handle mixed type children correctly - fixes #443 --- mithril.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mithril.js b/mithril.js index 29082ca9..07cd891e 100644 --- a/mithril.js +++ b/mithril.js @@ -51,12 +51,12 @@ var m = (function app(window, undefined) { if (classes.length > 0) cell.attrs[classAttrName] = classes.join(" "); - var children = hasAttrs ? args[2] : args[1]; - if (type.call(children) === ARRAY) { - cell.children = children + var children = hasAttrs ? args.slice(2) : args.slice(1); + if (children.length === 1 && type.call(children[0]) === ARRAY) { + cell.children = children[0] } else { - cell.children = hasAttrs ? args.slice(2) : args.slice(1) + cell.children = children } for (var attrName in attrs) {