From 807c6f415a27d693b69342cdb3df368c82d359f5 Mon Sep 17 00:00:00 2001 From: oleg8sh Date: Sat, 9 Aug 2014 00:03:22 +0400 Subject: [PATCH] typeof is much faster than {}.toString() Proof: http://jsperf.com/typeof-vs-instanceof-vs-object-prototype-tostring --- mithril.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mithril.js b/mithril.js index 7ba2c900..37afe48f 100644 --- a/mithril.js +++ b/mithril.js @@ -153,7 +153,7 @@ Mithril = m = new function app(window, undefined) { cached.nodes.intact = true if (shouldReattach === true) parentElement.insertBefore(node, parentElement.childNodes[index] || null) } - if (type.call(data.attrs["config"]) == "[object Function]") { + if (typeof data.attrs["config"] === "function") { configs.push(data.attrs["config"].bind(window, node, !isNew, cached.configContext = cached.configContext || {}, cached)) } }