mustang2247 / svgweb

Automatically exported from code.google.com/p/svgweb
Other
0 stars 0 forks source link

When node removed or added, mouseover and mouseout events are produced by flash but not native #464

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. open page http://svg.kvalitne.cz/map/map5.html
2. there should have region on onmouseover changed properties of stroke and
at the same time is element removed from DOM and append again (to be the
most top one)
3. it is not working in SVG Web but in all other SVG implementations is

What is the expected output? What do you see instead?
Try the link with other SVG browser. Other cases of changing attributes,
when element is not removed from DOM and appended again, is working in this
case (http://svg.kvalitne.cz/map/map5u.html) where stroke standalone works
as well, but without bringing it to the front is functionality result is
ugly...

What version of the product are you using? On what operating system,
browser, and version of Flash?
svgweb-2009-11-23-Gelatinous-Cube.zip , 10,0,22,87, Windows XP/W7, IE 8.0.6001

Please provide any additional information below. Reduced test cases are
always appreciated!
The only difference is DOM manipulation. I tried several workarounds but
failed utterly... :-(

Original issue reported on code.google.com by marek.ra...@gmail.com on 22 Mar 2010 at 2:02

GoogleCodeExporter commented 8 years ago
This is the code you should use in your mouseover handler which will solve your 
problem:

      if (evt.target.nextSibling) {
          evt.target.parentNode.appendChild(evt.target);
      }

This depends on the fix to Issue 296 in r1050. Without that fix, you'll still 
need to
remove the target from the parent before appending it back.

The reason for checking that there is a nextSibling is to prevent a strange 
problem
with flash, with the added benefit of optimizing out the DOM call(s) when not 
necessary.

The strange problem with flash is that when you remove a node that the mouse is
sitting over, it will produce a mouseout event. When you add the node back, it
produces a mouseover event. Since you are removing a node and adding a node in 
its
mouseover handler, that produces an infinite loop of mouse events which causes 
the
flash renderer to indefinitely postpone rendering of the node. So, the border 
never
renders and the opacity never changes.

I tried to simulate firefox behavior which somehow does not produce the mouse 
events.
Actually firefox is somewhat finicky about when it produces the mouseover 
event. If I
remove and add the node in one line of input at the firebug prompt, I actually 
get
another mouseover event in firefox when I move my mouse again. But this does not
occur if the node was removed and added from the moveover event handler. This is
strange behavior, and I'm not sure it is worth trying real hard to emulate 
this. I
would advise altering your code as I've suggested to avoid the infinite loop. 
To be
honest, I'm doubt this issue will get resolved in the foreseeable future.

Original comment by grick23@gmail.com on 28 Mar 2010 at 1:38