fix Ox.typeOf

This commit is contained in:
rolux 2012-05-25 21:19:27 +02:00
parent f46ff46da8
commit 5ad848c563

View file

@ -303,7 +303,7 @@ Ox.isUndefined = function(value) {
Ox.typeOf <f> Returns the type of a value
(value) -> <s> Type
value <*> Any value
> (function() { return Ox.typeOf(arguments); }())
> Ox.typeOf((function() { return arguments; }()))
'arguments'
> Ox.typeOf([])
'array'
@ -341,18 +341,17 @@ 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
(function() {
if (
Ox.typeOf(arguments) != 'arguments'
if (
Ox.typeOf((function() { return 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') {
if (ret == 'object' && typeof value.callee == 'function') {
ret = 'arguments';
} else if (
ret == 'htmlcollection' || (
@ -369,5 +368,4 @@ Ox.typeOf = function(value) {
}
return ret;
};
}
})();
}