xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Slater" <dsla...@simulsoft.com>
Subject EventListener does not respond to DOM mutations if added after document is loaded
Date Wed, 19 Nov 2008 17:12:18 GMT
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


Mime
View raw message