diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c
index da2d59bc894..9995f40a571 100644
--- a/dlls/mshtml/htmlevent.c
+++ b/dlls/mshtml/htmlevent.c
@@ -2201,7 +2201,7 @@ static BOOL check_event_iface(nsIDOMEvent *event, REFIID riid)
return TRUE;
}
-static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id)
+static DOMEvent *alloc_event(nsIDOMEvent *nsevent, compat_mode_t compat_mode, eventid_t event_id)
{
dispex_static_data_t *dispex_data = &DOMEvent_dispex;
DOMEvent *event = NULL;
@@ -2266,11 +2266,11 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id)
else
event->keyboard_event = NULL;
- init_dispex(&event->dispex, (IUnknown*)&event->IDOMEvent_iface, dispex_data);
+ init_dispex_with_compat_mode(&event->dispex, (IUnknown*)&event->IDOMEvent_iface, dispex_data, compat_mode);
return event;
}
-HRESULT create_event_from_nsevent(nsIDOMEvent *nsevent, DOMEvent **ret_event)
+HRESULT create_event_from_nsevent(nsIDOMEvent *nsevent, compat_mode_t compat_mode, DOMEvent **ret_event)
{
eventid_t event_id = EVENTID_LAST;
DOMEvent *event;
@@ -2290,7 +2290,7 @@ HRESULT create_event_from_nsevent(nsIDOMEvent *nsevent, DOMEvent **ret_event)
}
nsAString_Finish(&nsstr);
- event = alloc_event(nsevent, event_id);
+ event = alloc_event(nsevent, compat_mode, event_id);
if(!event)
return E_OUTOFMEMORY;
@@ -2313,7 +2313,7 @@ HRESULT create_document_event_str(HTMLDocumentNode *doc, const WCHAR *type, IDOM
return E_FAIL;
}
- event = alloc_event(nsevent, EVENTID_LAST);
+ event = alloc_event(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), EVENTID_LAST);
nsIDOMEvent_Release(nsevent);
if(!event)
return E_OUTOFMEMORY;
@@ -2337,7 +2337,7 @@ HRESULT create_document_event(HTMLDocumentNode *doc, eventid_t event_id, DOMEven
return E_FAIL;
}
- event = alloc_event(nsevent, event_id);
+ event = alloc_event(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), event_id);
if(!event)
return E_OUTOFMEMORY;
diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h
index 69655d2a4ee..fc581ee5398 100644
--- a/dlls/mshtml/htmlevent.h
+++ b/dlls/mshtml/htmlevent.h
@@ -110,7 +110,7 @@ void dispatch_event(EventTarget*,DOMEvent*) DECLSPEC_HIDDEN;
HRESULT create_document_event(HTMLDocumentNode*,eventid_t,DOMEvent**) DECLSPEC_HIDDEN;
HRESULT create_document_event_str(HTMLDocumentNode*,const WCHAR*,IDOMEvent**) DECLSPEC_HIDDEN;
-HRESULT create_event_from_nsevent(nsIDOMEvent*,DOMEvent**) DECLSPEC_HIDDEN;
+HRESULT create_event_from_nsevent(nsIDOMEvent*,compat_mode_t,DOMEvent**) DECLSPEC_HIDDEN;
void init_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void release_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN;
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index 750f5cfd5e0..700eee4d779 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -1659,7 +1659,7 @@ static nsresult NSAPI nsContextMenuListener_OnShowContextMenu(nsIContextMenuList
if(FAILED(hres))
return NS_ERROR_FAILURE;
- hres = create_event_from_nsevent(aEvent, &event);
+ hres = create_event_from_nsevent(aEvent, dispex_compat_mode(&node->event_target.dispex), &event);
if(SUCCEEDED(hres)) {
dispatch_event(&node->event_target, event);
IDOMEvent_Release(&event->IDOMEvent_iface);
diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c
index 21b59cf6e1d..b060ae521c5 100644
--- a/dlls/mshtml/nsevents.c
+++ b/dlls/mshtml/nsevents.c
@@ -270,7 +270,7 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
}
if(doc->window) {
- hres = create_event_from_nsevent(event, &load_event);
+ hres = create_event_from_nsevent(event, dispex_compat_mode(&doc->node.event_target.dispex), &load_event);
if(SUCCEEDED(hres)) {
dispatch_event(&doc->window->event_target, load_event);
IDOMEvent_Release(&load_event->IDOMEvent_iface);
@@ -319,7 +319,7 @@ static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *
if(FAILED(hres))
return NS_OK;
- hres = create_event_from_nsevent(nsevent, &event);
+ hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), &event);
if(FAILED(hres)) {
node_release(node);
return NS_OK;
diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c
index 8790807ce77..0ee05f04e40 100644
--- a/dlls/mshtml/xmlhttprequest.c
+++ b/dlls/mshtml/xmlhttprequest.c
@@ -205,7 +205,7 @@ static nsresult NSAPI XMLHttpReqEventListener_HandleEvent(nsIDOMEventListener *i
if(!This->xhr)
return NS_OK;
- hres = create_event_from_nsevent(nsevent, &event);
+ hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&This->xhr->event_target.dispex), &event);
if(SUCCEEDED(hres) ){
dispatch_event(&This->xhr->event_target, event);
IDOMEvent_Release(&event->IDOMEvent_iface);