// some event don't apply on all kind of nodes, for instance "blur"
if (!event.applies(node)) {
return null;
}
final boolean ie = jsNode_.getWindow().getWebWindow().getWebClient().getBrowserVersion().isIE();
ScriptResult allResult = null;
final List<Function> handlers = getHandlers(event.jsxGet_type(), useCapture);
if (handlers != null && !handlers.isEmpty()) {
event.setCurrentTarget(jsNode_);
final HtmlPage page = (HtmlPage) node.getPage();
// make a copy of the list as execution of an handler may (de-)register handlers
final List<Function> handlersToExecute = new ArrayList<Function>(handlers);
for (final Function listener : handlersToExecute) {
final ScriptResult result = page.executeJavaScriptFunctionIfPossible(listener, jsNode_, args, node);
if (event.isPropagationStopped()) {
allResult = result;
}
if (ie) {
if (ScriptResult.isFalse(result)) {
allResult = result;
}
else {
final Object eventReturnValue = event.jsxGet_returnValue();
if (eventReturnValue instanceof Boolean && !((Boolean) eventReturnValue).booleanValue()) {
allResult = new ScriptResult(false, page);
}
}
}
}
}