- From: Dean Jackson <dean@w3.org>
- Date: Thu, 6 Feb 2003 23:02:06 +1100
- To: Sigurd Lerstad <sigler@bredband.no>
- Cc: www-svg@w3.org, www-html@w3.org
Hi Sigurd, On Sun, 02 Feb 2003, Sigurd Lerstad wrote: > In my SVG editor/viewer. I'm trying to add XML Events support (skipping > completely how events have been previously done :) Great! > The New draft of SVG1.2 may have more on how this should work in SVG, but > until then I thought I'd check out how it's done in XHTML 2. And there's a > short section about it, but it doesn't say anything that's not already in > the XML Events spec. I think I understand the XML Events spec, but am having > trouble how to relate. Ok. Let me preface this response with a big I MIGHT BE WRONG! (in fact it's more likely that not). If I am, then hopefully a discussion will start. > 1. > > <listener ev:handler="#somehandler" > > how is a XHTML/SVG document supposed to deal with that, what if e.g > > <p id="somehandler"> > > What should happen when listener gets an event, what should it do to the p > element? I believe that is left up to the host language. In this case, the <p> element (I assume it is an HTML <p>) has no way of handling the event so the event just disappears. > 2. > > Is javascript allowed inside the ev:handler attribute? No. Only a URI reference. > 3. > > In this example from the XML Events spec: > <script type="application/x-javascript" > ev:event="submit" ev:observer="form1"> > return docheck(event); > </script> > > where is the event variable inside docheck coming from, is this a global > object fetched from the global 'window' object, or is an object named > 'event' always passed in? Welcome to the big mess that is scripting. In SVG, most implementations just load all the code in the script element into a single shared namespace (I'm not sure if that is specified, but that is how it is done). So, in this case the above example doesn't really make sense (since there is no enclosing function, and no way to enter the code at that point). (Again, it's likely that I'm wrong here). As for the magic "event" variable, it seems that most scripting implementations define a variable called "event" or "evt" to be used in a handler attribute (e.g. onmousedown="docheck(evt)"). To me it is unclear what's supposed to happen here. Anyone have any ideas? Dean
Received on Thursday, 6 February 2003 07:02:17 UTC