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]