W3C home > Mailing lists > Public > public-webapi@w3.org > March 2007

Re: DOM Events

From: Jean-Yves Bitterlich <Jean-Yves.Bitterlich@Sun.COM>
Date: Thu, 29 Mar 2007 16:29:35 +0200
To: Bjoern Hoehrmann <derhoermi@gmx.net>
Cc: public-webapi@w3.org
Message-id: <460BCD4F.9040600@sun.com>
Thanx very much for the prompt reply.
here tackling the EventTarget.dispatchEvent point:
(see inline)

Bjoern Hoehrmann wrote:
> * Jean-Yves Bitterlich wrote:
>> Method: EventTarget.dispatchEvent(Event evt)
>> It is unclear how to notify an application about incorrect event target,
>> when correct event is being dispatched to incorrect eventTarget by
>> EventTarget.dispatchEvent(Event evt).
> Thank you for your comments. The DOM Event Model does not have a notion
> of correct event types for an event target, and there is consequently no
> way to inform applications of semantic errors it might have made. It is
> in fact difficult to see how such a notion might be defined. For example
> the DOMAttrModified event is currently defined only for Element nodes in
> the DOM Event Flow, but future specifications might re-use it to inform
> applications of changes of pseudo-attributes on processing instructions
> like xml-stylesheet. Applications might then use dispatchEvent to simu-
> late this in legacy implementations.
The feedback from our developer:

List of event types is declared in the section  "1.4.2 Complete list of 
event types" of "Document Object Model (DOM) Level 3 Events 
Let's examine the DOMActivate UIEvent. According to this section: "Some 
events will only be dispatched to a specific set of possible targets, 
specified using node types.". The possible target for DOMActivate event 
is an Element only (according to the table in this section). I will be 
using JAVA syntax.

First step, I created an intstance of UIEvent with type DOMActivate by 
DocumentEvent.createEvent("UIEvent") and UIEvent.initUIEvent(..) with 
appropriate parameters.

Second step, I tried to dispatch this instance of UIEvent to Comment by 

Specification doesn't explain, what a DOM implementation SHOULD DO in 
this case. I mean, that event target is incorrect (not suitable) in this 
case (see column "Target node types" in the table of "information on the 
event types" in the section 1.4.2). Also  I can't find any appropriate 
notifications in specification for applications. Such notifications may 
be useful for application development.

I can suggest three possible use cases for such situations:

1) Dispatch event to the "incorrect" (not suitable) event target and add 
appropriate description to specification.
Cases when "event targets able to restrict the types of events which can 
be dispatched to them"
2) Add new Exception to the section "Exceptions" of 
EventTarget.dispatchEvent, throw it and add appropriate description to 
3) Do nothing and add appropriate description to specification.

I guess that second case is more preferable for application developer.

Best regards,

>> Method: MutationEvent.initMutationEvent(NS)(...)
>> Few parameters have "This value may be null". Parameter "relatedNode"
>> not although it is possible that this arg is null...
> Thanks for spotting this error, the next draft will note that this para-
> meter may indeed be null, perhaps indirectly, saying that the parameters
> to an init method may be null iff the attribute may be null. There may
> be similar errors in the draft, please let us know if you find more.
>> Method: DocumentEvent.canDispatch()
>> The documentation of canDispatch says: "Tests if the implementation can
>> generate events of a specified type." while the return value description
>> is: "true if the implementation can generate and dispatch this event type,
>> false otherwise" Note there is "and dispatch" part of the assertion. If
>> we remove this part, then there will be no reason for confusion with an
>> application events. Now it sounds like the implementation cannot dispatch
>> application specific events.
> I think simply removing the offending phrase is not the best course of
> action, at least not until the draft defines what it means if an imple-
> mentation is able to generate an event type. I will try to come up with
> better text for this.
> Thanks again for your comments. Please let us know if you have further
> input on the document.

<http://www.sun.com/> 	*Jean-Yves Bitterlich*
Senior Staff Engineer
*Sun Microsystems GmbH*
Sonnenallee 1, 85551 Heimstetten, Germany
/Mobile: / 	+49-172-8187243
/Phone: / 	+49-89-46008-1097 (x61097)
/Fax: / 	+49-89-46008-2978 (x62978)
/Email: / 	Jean-Yves.Bitterlich@Sun.COM

Amtsgericht München: HRB 161028
Geschäftsführer: Marcel Schneider, Wolfgang Engels, Dr. Roland Bömer
Vorsitzender des Aufsichtsrates: Martin Häring
WEEE-Reg.-Nr. DE 20803943
HypoVereinsbank München, Konto 31 625 009, BLZ 700 202 70
Received on Thursday, 29 March 2007 14:29:53 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:23 UTC