Worryingly in IE8 this is the "state of play" :
// IE8
Object.prototype.toString(Error.valueOf)
/* [object Object] */
typeof Error.valueOf
/* function */
JavaScript Error is not DOM object. Is this an "edge case" or not?
Anyway, I posted too fast, the version bellow works.
( function () {
// GPL (c) 2009 by DBJ.ORG
isFunction = typeof (top.alert) === "object" ?
function(x) {
switch (typeof x) {
case "function" : return true ;
case "object" : return (x + "").match(/
function/) !== null ;
default : return false ;
}
}
: /* non IE browsers use this */
function (x) {
return x instanceof Function;
}
})()
@Azat : "By the way, ‘x instanceof Function’ leaks for window and DOM
objects in IE. " ...
True. But above "instanceof" is used only in non-IE browsers.
--DBJ
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---