in Ox.typeOf, handie IE nodelist (htmlcollection)
This commit is contained in:
parent
9d4128c787
commit
67fcca7304
1 changed files with 15 additions and 8 deletions
|
@ -337,11 +337,18 @@ Ox.typeOf <f> Returns the type of a value
|
||||||
Ox.typeOf = function(value) {
|
Ox.typeOf = function(value) {
|
||||||
return Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
|
return Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
|
||||||
};
|
};
|
||||||
if (Ox.typeOf() != 'undefined') {
|
(function() {
|
||||||
// Handle Mobile Safari
|
// Internet Explorer returns 'HTMLCollection' instead of 'NodeList',
|
||||||
Ox.typeOf = function(value) {
|
// Mobile Safari doesn't like null and undefined
|
||||||
return value === null ? 'null'
|
var nodelist = Ox.typeOf(document.getElementsByTagName('a'));
|
||||||
: value === void 0 ? 'undefined'
|
if (nodelist != 'nodelist' || Ox.typeOf() != 'undefined') {
|
||||||
: Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
|
Ox.typeOf = function(value) {
|
||||||
};
|
var type = value === null ? 'null'
|
||||||
}
|
: value === void 0 ? 'undefined'
|
||||||
|
: Object.prototype.toString.call(
|
||||||
|
value
|
||||||
|
).slice(8, -1).toLowerCase();
|
||||||
|
return type == nodelist ? 'nodelist' : type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
Loading…
Reference in a new issue