Complete Minimal Classes
khs4473 at gmail.com
Sat Apr 7 05:17:55 PDT 2012
> Why? I mean, what built-in in ECMA-262 or a DOM spec needs non-method data
> properties? Methods and accessors, yes. Constants go on the constructor.
> I'm probably forgetting some bogus Java-like WebIDL binding rule here...
The Event constants (AT_TARGET, etc.) are defined on the Event prototype
(as well as on the constructor). Another use case, mentioned by Dave,
would be adding generic methods defined elsewhere to the prototype. Or if
you wanted to add methods using a template function:
Even here, you can be spoofed by calling the constructor on an
> already-constructed instance. It's hard to tell 'new' from invocation by
> checking facts about |this|.
Right - which is why it would be nice to be able to specify the behaviors
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss