Open GoogleCodeExporter opened 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
Original issue reported on code.google.com by
marek.ra...@gmail.com
on 22 Mar 2010 at 2:02