Re: DOM Level 3 Events (and XPath)

Christian Parpart wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> hi all,
> 
...
> 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.

> 4. EventFOO.initFOO[NS](...)
> 
> Letting all these methods returning the Event that they are (this) would be 
> very helpful for the application programmer since it sometimes makes sense to 
> combine several functionis together.
> 
> There's my C++ use case:
> 
> dispatchEvent(document->createEvent("Foo")->initFoo("bar"));
> 
> Although while C++ does not have any GC I assume that the 
> EventTarget.dispatchEvent() method may take ownerchip of its
> passed event object. does this violate the spec to be conform?

This is more a coding style issue than anything else. As for the 
ownership issue, the spec doesn't attempt to define that since there's 
no common rules that apply in every case. IOW, it's up to the 
implementation to define the ownership of DOM objects. Making the DOM 
implementation delete events that are dispatched is IMO not a good idea 
since it limits what type of event objects you can pass in. For 
instance, you can't create a custom event on the stack (i.e. w/o 
allocating it on the heap) if your dispatch code deletes the events 
after they're dispatched, and you can't create an array of events and 
pass in an event in that array (since the array items can't be deleted, 
all arrays might live in one contigous block of memory). And so on.

...
> 
> That's it so far,
> Christian.
> 
> - -- 
>  15:59:54 up 62 days,  7:08,  0 users,  load average: 0.00, 0.00, 0.00
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.2 (GNU/Linux)
> 
> iD8DBQE/G/bbPpa2GmDVhK0RAuztAJ9BuC2cCW/P7l0P+E/CKHzgtgvHqwCfWt3h
> vBe8ugKZRVUrtwzSFuPanw0=
> =G0e5
> -----END PGP SIGNATURE-----
> 

-- 
jst

Received on Tuesday, 22 July 2003 20:08:20 UTC