Re: DOM Level 3 Events (and XPath)

Hash: SHA1

On Wednesday 23 July 2003 2:07 am, Johnny Stenback wrote:
> > 2. interface CustomEvent
> >
> > I do not believe that CustomEvent is needed since I even just implemented
> > it after have the main stuff working from the events stuff.
> > AFAIK CustomEvent gives just access to some members for at least the
> > EventTarget's dispatching methods. While I do not know whether Java does
> > support friend classes to access private members I still propose to
> > remove this interface since it is very implementation specific and there
> > is really no need for the application writer to have access to these
> > private members of the Event interface - or give me some reasonable
> > examples :o)
> One scenario where this is needed is in mixed language implementations
> like Mozilla (just to name one). There script writer can create custom
> events in JavaScript (or whatever supported scripting language, at least
> in theory) and dispatch them, in this case the C++ implementation that
> does the actual dispatch needs to be able to set the target, and so on.
> In this case it gets really hard if not impossible to do this w/o a
> well-defined interface on custom events that have setters for those
> readonly attributes in question.

Yes, of course, but EventTarget.dispatchEvent() has direct access to the Event 
properties (read/write) since the language C++ allows classes to be friends 
of other classes (EventTarget is a friend of Event, so it can even access 
private members).
JavaScript does not need to implement the dispatchEvent algorithm so you don't 
need this here. Furthermore, for creating custom events you don't need the 
CustomEvent interface to modify the base properties of the Event object since 
you can initialize it via initEvent[NS] and all remaining properties are 
related to the EventTarget.dispatchEvent function that means, that this 
function will write to theses properties itself.

(Or did I misunderstand something?)

Christian Parpart.

- -- 
 00:33:27 up 70 days, 15:39,  0 users,  load average: 0.06, 0.07, 0.30
Version: GnuPG v1.2.2 (GNU/Linux)


Received on Tuesday, 29 July 2003 18:40:16 UTC