Hi,

Yes, I use "addEventListener" too, but to make sure that in "all" browsers
(old and new) it works as I have stated.

" Using DOM level 0 interfaces (e.g. get/setAttribute) for registering event
listeners seems novel, but I have never seen it used in practice. Does it
have any advantages over addEventListener?"

It may seem novel, but it works in all browsers, and that is what counts.

Cheers,
Chris

-----Original Message-----
From: svg-developers@yahoogroups.com [mailto:svg-developers@yahoogroups.com]
On Behalf Of Jacob Beard
Sent: Donnerstag, 15. September 2011 02:54
To: svg-developers@yahoogroups.com
Subject: Re: [svg-developers] Re: No Keyboard Events

Hi,

Just a few notes about your example.

First, I believe you should use document.documentElement as opposed to
document.rootElement.

Second, I think addEventListener is the recommended method for registering
event listeners on DOM nodes:
https://developer.mozilla.org/en/DOM/element.addEventListener

Using DOM level 0 interfaces (e.g. get/setAttribute) for registering event
listeners seems novel, but I have never seen it used in practice. Does it
have any advantages over addEventListener?

Third, in your example, is it really necessary to prefix "ecmascript" to the
callback function name? My understanding is that, as opposed to clicking a
link with an "ecmascript" or "javascript" URI handler, the string contents
of on* attributes will simply be evaled in the global scope. If that's the
case, then your example might actually fail with a syntax error.

Best,

Jake

On Wed, Sep 14, 2011 at 8:25 PM, Chris Peto
<svg...@resource-solutions.de>wrote:

>
>
> Hi,
>
> You will find that these work for all browsers:
>
>
>
document.rootElement.setAttribute("onkeypress","ecmascript:gKeyPress(evt);")
> ;
>
>
document.rootElement.setAttribute("onkeydown","ecmascript:gKeyDown(evt);");
>
> document['onkeypress'] = gKeyPress;
>
> document['onkeydown'] = gKeyDown;
>
> function gKeyPress(evt)
>
> {
>
> ...
>
> }
>
> function gKeyDown(evt)
>
> {
>
> ...
>
> }
>
> Hope this helps.
>
> Cheers,
>
> Chris
>
> From: svg-developers@yahoogroups.com [mailto:
> svg-developers@yahoogroups.com]
> On Behalf Of dark3251
> Sent: Donnerstag, 15. September 2011 02:07
> To: svg-developers@yahoogroups.com
> Subject: [svg-developers] Re: No Keyboard Events
>
>
> Interesting. I could just keep track of the last element clicked or
> something similar. Certainly not ideal but I can live with that until
> something better comes along.
>
> So what would be the actual function of these focus events if there are no
> built in keyboard events? I did a quick test but i couldn't even get the
> event to trigger.
>
> --- In svg-developers@yahoogroups.com
> <mailto:svg-developers%40yahoogroups.com> , Jacob Beard <jbeard4@...>
> wrote:
> >
> > I think your best bet for handling keyboard events interoperably across
> SVG
> > renderers is to register the key* event listener (keyup, keydown,
> keypress)
> > on the document root element. Some renderers do things differently - for
> > example Batik can receive keypress events on individual elements based
on
> > the mouse position.
> >
> > Jake
> >
> > On Wed, Sep 14, 2011 at 2:55 PM, dark3251 <dark3251@...> wrote:
> >
> > >
> > >
> > > Am I right to assume there are no keyboard events associated with SVG
> at
> > > this time? I see nothing in the specifications although the confusing
> thing
> > > to me is that I see events describing "focus" as if there were
keyboard
> > > events (e.g. onfocusin/out). Am I just misunderstanding the meaning of
> focus
> > > here?
> > >
> > >
> > >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
> [Non-text portions of this message have been removed]
>
>  
>


[Non-text portions of this message have been removed]



------------------------------------

-----
To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----Yahoo! Groups Links





------------------------------------

-----
To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
----Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    svg-developers-dig...@yahoogroups.com 
    svg-developers-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    svg-developers-unsubscr...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to