On Aug 4, 10:04 am, DBJDBJ wrote:
> Worryingly in IE8 this is the "state of play" :
> // IE8
> Object.prototype.toString(Error.valueOf)
> /* [object Object] */
Shouldn't there be a - .call - or - .apply - following the - toString
- above, else the result is just what would be expected from calling
the - toString - method Object.prototype - (it is an ordinary native
object after all)? (Arguments to the - Object.prototype.toString -
method being insignificant, so ignored.)
> typeof Error.valueOf
> /* function */
>
> JavaScript Error is not DOM object. Is this an "edge case" or not?
The evidence above makes it look like it is a mangled test rather than
an edge case.
> 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;
<snip>
This would be "works" in the sense of; only if you don't consider
testing an object from one frame with this function defined in
another, and nobody passes it a native object that inherits from -
Function.prototype -.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---