Events: Controlling Bubbling and Cancelling

[Oh, not him again...]

Still more questions:

Some predefined Events are designated as "cancellable" or "bubbles". Is 
this "knowledge" to be built into the DOM implementation, i.e. while 
processing an event on a Node, the implementation looks up the attributes 
or restrictions of the specific event (e.g. in a static table) and 
ignores the Event's cancelBubble and returnValue property, if required?
This would pose problems with user-specified event types the 
implementation knows nothing about.

On the other hand, by initially setting the cancelBubble and returnValue 
properties of an Event accordingly one can specify the desired behaviour. 
So, is it the user's responsibility to set up the Event properties 
properly according to the standard if he directs standard event types 
towards the DOM implementation (e.g. nodeInsertedOntoParent)? (I'd favor 
this option.)

A note on the description of the event flow: For not-so-bright people 
like me it would be a good idea to include a note on how an EventListener 
is supposed to set the boolean Event properties (cancelBubble, 
cancelCapture and returnValue). It took me a while to figure out that the 
desired value (true or false) (most probably...???) is to be OR'ed to the 
current value of the Event property. Otherwise, it would be possible that 
one EventListener sets the property to true, whereas a following 
EventListener sets it to false again - which naturally is not allowed to 
happen. Or, said in a different way: an EventListener only actively 
changes one of the boolean properties if it wants to set it to true.

One problem remains, however: If I send an event with returnValue=true 
(i.e., execute the default action by default), no EventListener will be 
able to set this property to false (according to the above convention), 
i.e. cancel the default action. If, on the other hand,  this event is 
sent with returnValue=false initially, how does the DOM implementation 
determine whether it is an active request to suppress the default action 
or if it's just the default value that wasn't changed by any 
EventListener during event processing?

Now, if we say: "The 'ORing' is only to be used with cancelBubble and 
cancelCapture", we're back at the problem of above: How can we resp. the 
DOM implementation decide/ensure that an event is not cancellable?

Also, could someone shed some light on what this "default action" (which 
is to be cancelled by setting Event.returnValue to false) actually is for 
some events?

Regards, Christian.

Received on Tuesday, 13 April 1999 10:10:57 UTC