Can DOM methods be native Function objects?

Cameron McCormack cam at
Sun Oct 10 14:24:42 PDT 2010

Per the spec, is it possible for the functions that correspond to
methods in the DOM be native Function objects?  The spec says that a
native object is an “object in an ECMAScript implementation whose
semantics are fully defined by this specification rather than by the
host environment”.  Does this mean that it must use the values for all
internal properties as described in the spec, including [[Call]]?

The [[Call]] for native Function objects relies on parsing an internal
[[Code]] property, which must be a FunctionBody.  The implementation of
the DOM object is likely not able to be represented by a FunctionBody
(i.e., native ES code).  Thus the function needs to have a custom

Host objects cannot have [[Class]] = "Function".  That is, however, what
browsers currently seem to have for DOM methods; ==
  "[object Function]"

in recent versions of major browsers I tried.

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.



Cameron McCormack ≝

More information about the es5-discuss mailing list