Sandy,
Thanks a lot for the Event Listener part. I did almost the same, but didn't
get the event called unless I dispatch the event after the new value set. I
must did something wrong.
-Bob
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 12, 2001 4:43 PM
Subject: Re: Document.ImportNode() and Events
> Hi Pat & Bob,
>
> > Sorry, I meant to ask do the Event Listeners registered with a Node get
> > imported along with the Node, i.e. do I have worry about re-registering
> > or un-registering an Event Listener.
>
> I couldn't find any evidence from the spec either. My understanding is
that
> Xerces doesn't import the event listeners when importing a node. So you
> might have to re-register them again.
>
> > When DOM changed/modified, related event should be dispatched
explicitly,
> > or the event will propagate automatically? In my experience, I have to
> > dispatch event at the target node, then all node with registered
> > eventListeners can get the event. This is not very convenient, and I
hope
> > that user doesn't need to have the event dispatched menually.
>
> Your event listener would be called automatically. For example:
> <root>
> <child att="value"/>
> </root>
>
> // suppose node points to "root"
> // initiate your listener
> EventListener el = new MyEeventListener();
> // register the listener
> ((EventTarget)node).addEventListener("DOMAttrModified", el, false);
> // first child is a text node, the next is element "child"
> Node child = node.getFirstChild().getNextSibling();
> // get the attribute node
> Node att = child.getAttributes().item(0);
> // now change the attribute value, and el.handleEvent() is called
> // at this point
> att.setNodeValue("newValue");
>
> Cheers,
> Sandy Gao
> Software Developer, IBM Canada
> (1-416) 448-3255
> [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]