diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c
index ddce8b30f67..a4fa95681d3 100644
--- a/dlls/mshtml/htmlevent.c
+++ b/dlls/mshtml/htmlevent.c
@@ -986,8 +986,11 @@ static HRESULT WINAPI DOMEvent_get_bubbles(IDOMEvent *iface, VARIANT_BOOL *p)
static HRESULT WINAPI DOMEvent_get_cancelable(IDOMEvent *iface, VARIANT_BOOL *p)
{
DOMEvent *This = impl_from_IDOMEvent(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ *p = variant_bool(This->cancelable);
+ return S_OK;
}
static HRESULT WINAPI DOMEvent_get_currentTarget(IDOMEvent *iface, IEventTarget **p)
@@ -1168,6 +1171,7 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id)
return NULL;
}
event->bubbles = (event_info[event_id].flags & EVENT_BUBBLES) != 0;
+ event->cancelable = (event_info[event_id].flags & EVENT_CANCELABLE) != 0;
}
nsIDOMEvent_AddRef(event->nsevent = nsevent);
return event;
@@ -1322,7 +1326,6 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event)
{
const eventid_t eid = event->event_id;
const listener_container_t *container = get_listener_container(event_target, event->type, FALSE);
- const BOOL cancelable = event_info[eid].flags & EVENT_CANCELABLE;
const BOOL use_quirks = use_event_quirks(event_target);
event_listener_t *listener, listeners_buf[8], *listeners = listeners_buf;
unsigned listeners_cnt, listeners_size;
@@ -1348,7 +1351,7 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event)
if(hres == S_OK) {
TRACE("%s <<< %s\n", debugstr_w(event->type), debugstr_variant(&v));
- if(cancelable) {
+ if(event->cancelable) {
if(V_VT(&v) == VT_BOOL) {
if(!V_BOOL(&v))
IDOMEvent_preventDefault(&event->IDOMEvent_iface);
@@ -1428,7 +1431,7 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event)
TRACE("%s <<< %s\n", debugstr_w(event->type),
debugstr_variant(&v));
- if(cancelable) {
+ if(event->cancelable) {
if(V_VT(&v) == VT_BOOL) {
if(!V_BOOL(&v))
IDOMEvent_preventDefault(&event->IDOMEvent_iface);
@@ -1453,7 +1456,7 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event)
if(hres == S_OK) {
TRACE("%s attached <<<\n", debugstr_w(event->type));
- if(cancelable) {
+ if(event->cancelable) {
if(V_VT(&v) == VT_BOOL) {
if(!V_BOOL(&v))
IDOMEvent_preventDefault(&event->IDOMEvent_iface);
@@ -1500,7 +1503,7 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event)
if(hres == S_OK) {
TRACE("cp %s [%u] <<<\n", debugstr_w(event->type), i);
- if(cancelable) {
+ if(event->cancelable) {
if(V_VT(&v) == VT_BOOL) {
if(!V_BOOL(&v))
IDOMEvent_preventDefault(&event->IDOMEvent_iface);
diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h
index 4f106d22fc5..38499d31f6f 100644
--- a/dlls/mshtml/htmlevent.h
+++ b/dlls/mshtml/htmlevent.h
@@ -67,6 +67,7 @@ typedef struct {
WCHAR *type;
EventTarget *target;
BOOL bubbles;
+ BOOL cancelable;
BOOL prevent_default;
BOOL stop_propagation;
DOM_EVENT_PHASE phase;
diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c
index 864d7d4a362..a943e41540b 100644
--- a/dlls/mshtml/tests/events.c
+++ b/dlls/mshtml/tests/events.c
@@ -2704,6 +2704,11 @@ static void test_create_event(IHTMLDocument2 *doc)
ok(hres == S_OK, "get_bubbles failed: %08x\n", hres);
ok(!b, "bubbles = %x\n", b);
+ b = 0xdead;
+ hres = IDOMEvent_get_cancelable(event, &b);
+ ok(hres == S_OK, "get_cancelable failed: %08x\n", hres);
+ ok(!b, "cancelable = %x\n", b);
+
IDOMEvent_Release(event);
IDocumentEvent_Release(doc_event);