diff --git a/source/Ox/js/Type.js b/source/Ox/js/Type.js index 258c7014..331ee625 100644 --- a/source/Ox/js/Type.js +++ b/source/Ox/js/Type.js @@ -341,31 +341,33 @@ Ox.typeOf = function(value) { // Internet Explorer 8 returns 'Object' instead of 'NodeList', // Internet Explorer 9 returns 'HTMLCollection' instead of 'NodeList', // Mobile Safari doesn't like null and undefined -if ( - Ox.typeOf(arguments) != 'arguments' - || Ox.typeOf(document.getElementsByTagName('a')) != 'nodelist' - || Ox.typeOf(null) != 'null' - || Ox.typeOf() != 'undefined' -) { - Ox.typeOf = function(value) { - var ret = Object.prototype.toString.call( - value - ).slice(8, -1).toLowerCase(); - if (typeof value.callee == 'function') { - ret = 'arguments'; - } else if ( - ret == 'htmlcollection' || ( - ret == 'object' - && typeof value.item != 'undefined' - && typeof value.length == 'number' - ) - ) { - ret = 'nodelist'; - } else if (value === null) { - ret = 'null'; - } else if (value === void 0) { - ret = 'undefined' - } - return ret; - }; -} +(function() { + if ( + Ox.typeOf(arguments) != 'arguments' + || Ox.typeOf(document.getElementsByTagName('a')) != 'nodelist' + || Ox.typeOf(null) != 'null' + || Ox.typeOf() != 'undefined' + ) { + Ox.typeOf = function(value) { + var ret = Object.prototype.toString.call( + value + ).slice(8, -1).toLowerCase(); + if (typeof value.callee == 'function') { + ret = 'arguments'; + } else if ( + ret == 'htmlcollection' || ( + ret == 'object' + && typeof value.item != 'undefined' + && typeof value.length == 'number' + ) + ) { + ret = 'nodelist'; + } else if (value === null) { + ret = 'null'; + } else if (value === void 0) { + ret = 'undefined' + } + return ret; + }; + } +})();