Hi:
I had the same problem. My IE crashed when I remove an element that has
an event associated with it.
(*)For instance, having:
var labelRectElement = document.createElementNS(svgNS,rect);
labelRectElement.addEventListener(mouseover,this,false);
//adding the labelRectElement to another node
var labelGroupElement = svgdoc.getElementById(labelGroup);
labelGroupElement.appendChild(labelRectElement);
(*)...when I try to do this (remove labelGroupElement):
labelGroupElement.parentNode.removeChild(labelGroupElement);
(*)..everything still working but when I reload the page or try to
change the URL to go to another site from the same window
my IE crashes. I guess internally some objects are still pointing to the
registered elements.
So I implemented a method that actually unregister any event from all
the childs nodes tree structure. It doesn't matter if an element
don't have an event associated, so it's safe to remove all anyway.
function removeChildElements(theParent, evtHandler) {
while((c = theParent.firstChild) != null) {
if (c.hasChildNodes()) {
removeChildElements(c, evtHandler); //recursive
} else {
if (c.nodeType == 1) {
c.removeEventListener(mousedown,evtHandler,false);
c.removeEventListener(mouseup,evtHandler,false);
c.removeEventListener(mouseover,evtHandler,false);
c.removeEventListener(mouseout,evtHandler,false);
c.removeEventListener(mousemove,evtHandler,false);
c.removeEventListener(click,evtHandler,false);
c.removeEventListener(keypress,evtHandler,false);
c.removeEventListener(SVGResize,evtHandler,false);
}
theParent.removeChild(c);
}
}
}
(*) So now I remove an element like this:
removeChildElements(labelGroupElement, this);
labelGroupElement.parentNode.removeChild(labelGroupElement);
(*)...and the IE don't crash anymore.
Hope that helps,
Renato F. Salas
Jorg Heymans wrote:
We've had some difficulties with this as well yes. The probleem seemed
to go away when you deregister the eventlisteners onunload().
HTH
Jorg
skrellkolja wrote:
I've been working with SVG for a while now and have encountered a very
irritating bug. At least that what I think it is.
Suddenly IE starts terminating on refresh or when trying to enter
another http-address. I have tried to understand when the problem
occurs and it seems to be after adding an eventListener.
Does anyone know of any known bugs connected to the eventListener??
thx
-
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click edit my
membership
Yahoo! Groups Links
-
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click edit my
membership
Yahoo! Groups Links
-
To unsubscribe send a message to: [EMAIL PROTECTED]
-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/
* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/