Can DOM methods be native Function objects?
brendan at mozilla.org
Sun Oct 10 15:28:10 PDT 2010
On Oct 10, 2010, at 2:24 PM, Cameron McCormack wrote:
> Host objects cannot have [[Class]] = "Function". That is, however, what
> browsers currently seem to have for DOM methods;
> Object.prototype.toString.call(Element.prototype.appendChild) ==
> "[object Function]"
> in recent versions of major browsers I tried.
Since 1995, in Netscape and Mozilla browsers.
If the spec says otherwise, the spec is an ass, to borrow from Dickens.
> Which one of the following is true?
> * these functions are indeed representable with a FunctionBody
> somehow, and thus don’t need a custom [[Call]];
> * a custom [[Call]] is needed, but native objects are allowed to have
> a custom [[Call]]; or
> * a custom [[Call]] is needed and thus the objects are host objects,
> but these browsers I tested don’t follow the spec in using a
> [[Class]] value different from those used in the spec.
Not the last, reality trumps spec fantasy, especially over 15 years.
Native functions do not have associated FunctionBody representations, of course; one clue is what toString returns.
So what is wrong with door #2?
> Cameron McCormack ≝ http://mcc.id.au/
> es5-discuss mailing list
> es5-discuss at mozilla.org
More information about the es5-discuss