diff --git a/dlls/mshtml/htmlattr.c b/dlls/mshtml/htmlattr.c
index 61c6455027a..8e72c9a8045 100644
--- a/dlls/mshtml/htmlattr.c
+++ b/dlls/mshtml/htmlattr.c
@@ -497,6 +497,7 @@ HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute *iface)
HRESULT HTMLDOMAttribute_Create(const WCHAR *name, HTMLElement *elem, DISPID dispid, HTMLDOMAttribute **attr)
{
+ compat_mode_t compat_mode = elem ? dispex_compat_mode(&elem->node.event_target.dispex) : COMPAT_MODE_QUIRKS;
HTMLAttributeCollection *col;
HTMLDOMAttribute *ret;
HRESULT hres;
@@ -511,8 +512,8 @@ HRESULT HTMLDOMAttribute_Create(const WCHAR *name, HTMLElement *elem, DISPID dis
ret->dispid = dispid;
ret->elem = elem;
- init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLDOMAttribute_iface,
- &HTMLDOMAttribute_dispex);
+ init_dispex_with_compat_mode(&ret->dispex, (IUnknown*)&ret->IHTMLDOMAttribute_iface,
+ &HTMLDOMAttribute_dispex, compat_mode);
/* For attributes attached to an element, (elem,dispid) pair should be valid used for its operation. */
if(elem) {