You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Dan Slater <ds...@simulsoft.com> on 2008/11/19 18:12:18 UTC
EventListener does not respond to DOM mutations if added after document is
loaded
Hi,
I need to dynamically add or remove an EventListener when the user
clicks on an element displayed on a JSVGCanvas. I am trying to listen
to DOM mutations. If I use this code prior to calling setDocument, the
listener works after the document is displayed:
EventTarget t = (EventTarget)elt;
t.addEventListener("DOMAttrModified", anchorListener, true);
parent.appendChild(typegroup);
However, when I add it during the interactive selection process, after
the document is already displayed in the JSVGCanvas, it doesn't work:
public void setSelectedAttributes(SVGElement elt){
elt.setAttributeNS(null, "selectionstate","selected");
EventTarget t = (EventTarget)elt;
t.addEventListener("DOMAttrModified", DX.anchorListener, true);
}
Of course, the canvas is set to ALWAYS_DYNAMIC.
I must be missing a fairly basic concept or command. Can someone please
help?
Dan Slater
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org