> Dear list,

Hi svgquestion,


> I have a very simple problem. I just would like to toggle the href attribute 
> on a use element with onmouseover and onmouseout events. It works in Firefox. 
> But It does not work in Chrome and IE9 ?

It's not *that* simple, it's even a somehow tricky situation as you are 
toggling the use target in runtime and the toggling itself is made between 
symbol elements...

That said, I've started instrumenting the code to try understand what was 
happening. Apparently both IE9 and Chrome are behaving as if the element is 
reset whenever replaced, including an event context loss, which causes a link 
replacement for each mouse event; the mouse out is never triggered due to that 
constant replacement (together with a performance hit as well - imagine a 
complex symbol being replaced dozens of times per second).

I've slightly adapted the code to avoid the replace-per-mouse-event symptom, by 
adding a check, and left the debug code in case anyone wants to take a look at 
what's happening. The modified functions follow:

function rec1(evt) {
  var element = evt.currentTarget;
  element.setAttributeNS(xlinkNS,"href","#symbolRect1");
  // allow seeing what's happening
  console.log(element.getAttributeNS(xlinkNS,"href"));
}

function rec2(evt) {
  var element = evt.currentTarget;
  // avoid replacing the symbol for each mouse event
  // (behavior seen in IE9 and Chrome/Safari)
  if(element.getAttributeNS(xlinkNS,"href") != "#symbolRect2"){
    element.setAttributeNS(xlinkNS,"href","#symbolRect2");
  }
  // allow seeing what's happening
  console.log(element.getAttributeNS(xlinkNS,"href"));
}


I'm not sure if this behavior might be underspecified in the SVG specification; 
at least for now, I'm leaving that part investigation for the experts. ;-)


> Thank you for your help

Hope this helps,
 Helder



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

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