public void bubbleApplyTemplates(Node node, Event event) {
if (principleEventListener) {
Controller.relayEvent(node, event); // make a call to this method for other instances
}
NodeInfo eventNode = ((HTMLDocumentWrapper)config.getHostPage()).wrap(node);
SequenceIterator bubbleElements = eventNode.iterateAxis(Axis.ANCESTOR, NodeKindTest.ELEMENT);
Controller controller = stylesheet.newTransformer();
try {
controller.importControllerSettings(localController);
XPathContext ruleContext = controller.newXPathContext();
Mode matchedMode = getModeFromEvent(event);
if (matchedMode == null) {
return;
}
// walk up the tree until we find an element with matching rule for the event mode
NodeInfo element = eventNode;
while (element != null) {
Rule matchedRule = matchedMode.getRule(element, ruleContext);
if (matchedRule != null && eventPropertyMatch(event, matchedRule)) {
logger.log(Level.FINER, "Bubble Apply-Templates - Mode: " + matchedMode.getModeName().getLocalName() +
" Element: " + controller.getNamePool().getLocalName(element.getNameCode()));
applyEventTemplates(matchedMode.getModeName().getClarkName(), element, event, null);
if (matchedRule.getIxslPreventDefault()) {
event.preventDefault();
}
break;
}
element = (NodeInfo)bubbleElements.next();
}
} catch (Exception e) {
handleException(e, "bubbleApplyTemplates");
}
}