RE: [SVGMobile12] namespace events are not qualified?

At 10:01 AM 5/19/2005, Mark Birbeck wrote:
>Hi Jon,

Hi Mark,
Very important issue here. Thanks for initiating discussion.


> > "click" and "ev:click" are equivalenced, so you can say either.
> > Most older W3C spec, including SVG 1.0/1.1, used DOM2 Events
> > which did not support namespacing. With DOM3 Events,
> > namespaced events were introduced and all of the standard
> > events defined in the DOM3 Events spec were defined to be in
> > the XML Events namespace. Thus, "click" was defined to be in
> > ev:click. The only way to make it so that old content which
> > just said "click" would still work in a user agent which
> > moves up to DOM3 Events is to say that "click" and "ev:click"
> > are equivalenced.
>
>Well, it's not really that they are 'equivalent'...more like promiscuous ;).

No, actually I really mean equivalent, not promiscuous. See below.


>Let's say we register for:
>
>    * click
>    * ev:click
>    * myns:click
>    * yourns:click
>
>
>1. If we dispatch the old DOM 2 Event "click", *all* of these listeners
>    will be triggered.

Assuming the ev: is assigned to the XML Events namespace and myns: and 
yourns: are assigned to different namespaces, then, no, if the mouse is 
clicked, then only the event listeners for "click" and "ev:click" would 
receive the event.  At least that is my thinking based on studying the DOM3 
Events spec which appears to retroactively claim that HTML's click event 
when namespaced becomes ev:click. Here is a sentence from DOM3 Events 
(http://www.w3.org/TR/DOM-Level-3-Events/events.html#Events-EventTypes-complete):

-----------------------------
For example, {"http://www.w3.org/2001/xml-events", "click"} can be targeted 
to all 
[<http://www.w3.org/TR/DOM-Level-3-Events/references.html#XHTML10>XHTML 
1.0] elements except applet, ..., and title....

The following list defines all event types (with the exception of two event 
types preserved for backward compatibility with 
[<http://www.w3.org/TR/DOM-Level-3-Events/references.html#HTML40>HTML 
4.01], see 
<http://www.w3.org/TR/DOM-Level-3-Events/events.html#Events-eventgroupings-htmlevents>HTML 
Events) provided in this specification. All event types defined in this 
specification are bound to the namespace URI 
"http://www.w3.org/2001/xml-events" ...
DOMActivate
...
click
...
-----------------------------

My reading of this is that HTML's old "click" event (without a namespace) 
has now been retroactively defined as being in the 
"http://www.w3.org/2001/xml-events" namespace.

What I am assuming is that an implementation would create a DOM3 Event 
object for all events, whether the event listener uses DOM2 or DOM3 
methods. For "click" events, the namespaceURI value on the Event object 
would be set to "http://www.w3.org/2001/xml-events". (Maybe for some 
implementations, the DOM3 Event object might need to be flattened into a 
DOM2 Event object at some point, but generally I do not think flattening 
will be required because of the upwards compatibility of the DOM3 Event 
object with the DOM2 Event object.)



>2. If we dispatch the new DOM 3 Event "ev:click" then we get the desired
>    behaviour, in that only the following two listeners would be triggered:
>
>    * click
>    * ev:click

Agreed.



>3. But if we dispatch some other DOM 3 Event "myns:click", the old DOM 2
>    Event listener is *still* triggered:
>
>    * click
>    * myns:click

I would say that only the "myns:click" event listener gets the event.


>    "ev:click" is correctly *not* triggered, but the problem here is that
>    "click" is probably not meant to be triggered, since the author has
>    been told it is 'equivalent' to "ev:click".
>
>
>So, as you can see "click" is not made equivalent to "ev:click", but
>equivalent to "everything:click"!

As you have probably gathered by now, I disagree.


>Personally, I think is not a great design; I may be the author of a document
>that used an sXBL that you wrote, and I may not be fully aware of the events
>that are flying around. To be safe I would need to make sure that none of my
>events are called anything in the DOM 3 Events specification.
>
>One possible solution would to go back to DOM 3 Events and make all 'legacy'
>or 'core' events exist in no namespace rather than "ev". That way there is
>only one "click" event, and it is the same event in both DOM 2 Events and
>DOM 3 Events.

Actually, I think it all works nicely if "click" is truly equivalenced to 
"ev:click", meaning that the assumed default namespace for legacy HTML and 
SVG events is "ev:". I believe that attempting to wildcard "click" to mean 
everything:click is what would cause problems.

Jon


>Regards,
>
>Mark
>
>
>Mark Birbeck
>CEO
>x-port.net Ltd.
>
>e: Mark.Birbeck@x-port.net
>t: +44 (0) 20 7689 9232
>w: http://www.formsPlayer.com/
>b: http://internet-apps.blogspot.com/
>
>Download our XForms processor from
>http://www.formsPlayer.com/

Received on Thursday, 19 May 2005 20:18:21 UTC