Commit ab210dd7 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IDOMEvent::stopImmediatePropagation implementaition.

parent e95db4c5
......@@ -1051,8 +1051,12 @@ static HRESULT WINAPI DOMEvent_stopPropagation(IDOMEvent *iface)
static HRESULT WINAPI DOMEvent_stopImmediatePropagation(IDOMEvent *iface)
{
DOMEvent *This = impl_from_IDOMEvent(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
TRACE("(%p)\n", This);
This->stop_immediate_propagation = This->stop_propagation = TRUE;
nsIDOMEvent_StopImmediatePropagation(This->nsevent);
return S_OK;
}
static HRESULT WINAPI DOMEvent_get_isTrusted(IDOMEvent *iface, VARIANT_BOOL *p)
......@@ -2210,7 +2214,8 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event, disp
}
}
for(listener = listeners; listener < listeners + listeners_cnt; listener++) {
for(listener = listeners; !event->stop_immediate_propagation
&& listener < listeners + listeners_cnt; listener++) {
if(listener->type != LISTENER_TYPE_ATTACHED) {
DISPID named_arg = DISPID_THIS;
VARIANTARG args[2];
......
......@@ -79,6 +79,7 @@ typedef struct {
BOOL cancelable;
BOOL prevent_default;
BOOL stop_propagation;
BOOL stop_immediate_propagation;
DOM_EVENT_PHASE phase;
IHTMLEventObj *event_obj;
......
......@@ -251,9 +251,19 @@ function test_stop_propagation() {
ok(e.defaultPrevented === false, "defaultPrevented = " + e.defaultPrevented);
}
function stop_immediate_propagation(e) {
calls += "immediateStop,";
e.stopImmediatePropagation();
ok(e.bubbles === true, "bubbles = " + e.bubbles);
ok(e.cancelable === true, "cancelable = " + e.cancelable);
ok(e.defaultPrevented === false, "defaultPrevented = " + e.defaultPrevented);
}
div1.addEventListener("click", stop_immediate_propagation, true);
div1.addEventListener("click", stop_propagation, true);
div1.addEventListener("click", record_call("div1.click(capture)"), true);
div2.addEventListener("click", stop_immediate_propagation, true);
div2.addEventListener("click", stop_propagation, true);
div2.addEventListener("click", record_call("div2.click(capture)"), true);
......@@ -265,11 +275,21 @@ function test_stop_propagation() {
calls = "";
div2.click();
ok(calls === "immediateStop,", "calls = " + calls);
div1.removeEventListener("click", stop_immediate_propagation, true);
calls = "";
div2.click();
ok(calls === "stop,div1.click(capture),", "calls = " + calls);
div1.removeEventListener("click", stop_propagation, true);
calls = "";
div2.click();
ok(calls === "div1.click(capture),immediateStop,", "calls = " + calls);
div2.removeEventListener("click", stop_immediate_propagation, true);
calls = "";
div2.click();
ok(calls === "div1.click(capture),stop,div2.click(capture),stop,div2.click(bubble),",
"calls = " + calls);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment