typeof is much faster than {}.toString()

Proof: http://jsperf.com/typeof-vs-instanceof-vs-object-prototype-tostring
This commit is contained in:
oleg8sh 2014-08-09 00:03:22 +04:00
parent e094292718
commit 807c6f415a

View file

@ -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))
}
}