Hello,
I am using a piece of JavaScript code (see below) that is designed to
add multiple UIEvent listeners to a node in the SVG tree. The idea is
that the listeners attached to this one node will capture events from
any of the defined mouse events occurring within that part of the SVG
view.
The problem is that only the first (DOMActivate) event listener attached
to a node gets noticed. The other listeners are ignored. Notice that for
each event listener added, the type is different so there is no reason
for subsequent listeners to be ignored.
Does anyone know why this behaviour is occurring?
Notes:
1) The two code fragments relate to the function attaching the event
listeners to the context node and the function that is called when the
event occurs. The guiEvent class and the uiEventAction function are
irrelevant to the problem.
// Initialise mouse event listeners for W3C DOM Events.
function initMouseEventListeners(contextNode) {
// Test to see if DOM Level 2 UIEvents are supported.
if(contextNode.getOwnerDocument().implementation.hasFeature('UIEvents',
'2.0')) {
contextNode.addEventListener("DOMActivate", processUIEvent,
false);
contextNode.addEventListener("mouseover", processUIEvent,
false);
contextNode.addEventListener("mouseout", processUIEvent, false);
contextNode.addEventListener("mousedown", processUIEvent,
false);
contextNode.addEventListener("mouseup", processUIEvent, false);
} else {
alert('No support for DOM 2 UIEvents!');
}
}
// Process User Interface events.
function processUIEvent(event) {
// Test to see if DOM Level 2 Events are supported.
if(event.target.getOwnerDocument().implementation.hasFeature('UIEvents',
'2.0')){
guiEvent.type = event.type;
guiEvent.target = event.target;
guiEvent.currentTarget = event.currentTarget;
guiEvent.documentX = event.x;
guiEvent.documentY = event.y;
guiEvent.screenX = event.pageX;
guiEvent.screenY = event.pageY;
guiEvent.ctrlKey = event.ctrlKey;
guiEvent.shiftKey = event.shiftKey;
guiEvent.altKey = event.altKey;
guiEvent.metaKey = event.metaKey;
guiEvent.button = event.button;
guiEvent.detail = event.detail;
guiEvent.relatedTarget = event.relatedTarget;
}
uiEventAction();
}
Regards
Philip Fennell
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]