Re: [svg-developers] Re: setting an event handler

2010-10-24 Thread ddailey
Thanks Jeff.

Yes, it looks as though evt is automatically assumed as the argument in all the 
browsers I've seen! Thanks, it's only three keystrokes longer than the other 
way.

cheers
David
  - Original Message - 
  From: jeff_schiller 
  To: svg-developers@yahoogroups.com 
  Sent: Sunday, October 24, 2010 12:26 PM
  Subject: [svg-developers] Re: setting an event handler




  --- In svg-developers@yahoogroups.com, ddailey ddai...@... wrote:
  
   Hi folks,
   
   I've always used something like 
   
   O.setAttribute(onclick,add(evt)) 
   
   to attach an event handler in SVG. But someone told me recently that 
   
   O.addEventListener(click, function(evt){add(evt)}, false)

  O.addEventListener(click, add, false)

  should work just fine. Is there a browser where it doesn't? I don't see any 
advantage to wrapping that function call in another function. 

  The third argument specifies whether you want to handle the event during the 
bubble or the capture phase (not possible using the onclick attribute).

  Another advantage to using addEventListener is that multiple handlers for the 
same event can be added.

  Regards,
  Jeff



  

[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 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/



Re: [svg-developers] Re: setting an event handler

2010-10-24 Thread ddailey
thanks Holger,

Just to make sure I understand, ... naming the function add( ) was just a 
coincidence since I was using it to add content to the SVG DOM. Would your  
comments be just as valid if I would have used

O.setAttribute(onclick, silly(evt) ) ?

If I clone a node, and then use (O.getAttribute(onclick)) I'm assuming the 
property or pseudo-property is still there to be interrogated even if I have 
used addEventListener? 

cheers
David

  - Original Message - 
  From: Holger Jeromin 
  To: svg-developers@yahoogroups.com 
  Sent: Sunday, October 24, 2010 10:51 AM
  Subject: [svg-developers] Re: setting an event handler



  ddailey schrieb am 23.10.2010 18:29:

   I've always used something like
   
   O.setAttribute(onclick,add(evt))
   
   to attach an event handler in SVG. But someone told me recently that
   
   
   O.addEventListener(click, function(evt){add(evt)}, false)
   
   is actually preferrable. (The person who told me this obviously has
   young fingers!)
   
   Well, why might that be? I have yet to see an example that fails to

  an add(evt) is an eval(add(evt))

  eval is considered evil :)

  This cannot be accelerated with the modern JIT Javascript optimisation
  in the Browsers.

  -- 
  best regards
  Holger



  

[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 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/