From d020d7f4b92ae4a4a0b3dd81ead9e6d977ed5f0f Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Wed, 8 Oct 2014 09:30:32 -0400 Subject: [PATCH] #298 improve object detection --- mithril.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mithril.js b/mithril.js index b2b5c30d..c0629133 100644 --- a/mithril.js +++ b/mithril.js @@ -1,7 +1,7 @@ Mithril = m = new function app(window, undefined) { var sObj = "[object Object]", sArr = "[object Array]", sStr = "[object String]" function type(obj) {return {}.toString.call(obj)} - function isObj(obj) {return type(obj) == sObj} + function isObj(obj) {return obj != null && type(obj) == sObj} function isArr(obj) {return type(obj) == sArr} function isFn(obj) {return typeof obj == "function"} function isStr(obj){ return type(obj) == sStr} @@ -812,7 +812,7 @@ Mithril = m = new function app(window, undefined) { var script = window.document.createElement("script") window[callbackKey] = function(resp){ - delete window[callbackKey] + window[callbackKey] = undefined window.document.body.removeChild(script) options.onload({ type: "load",