diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 20415ba62d0..d70f77b6e1f 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -1300,6 +1300,8 @@ HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
ret = HTMLBodyElement_Create(nselem);
else if(!strcmpW(class_name, wszINPUT))
ret = HTMLInputElement_Create(nselem);
+ if(!strcmpW(class_name, wszSELECT))
+ ret = HTMLSelectElement_Create(nselem);
else {
ret = mshtml_alloc(sizeof(HTMLElement));
@@ -1307,9 +1309,7 @@ HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
ret->destructor = NULL;
ret->nselem = nselem;
- if(!strcmpW(class_name, wszSELECT))
- HTMLSelectElement_Create(ret);
- else if(!strcmpW(class_name, wszTEXTAREA))
+ if(!strcmpW(class_name, wszTEXTAREA))
HTMLTextAreaElement_Create(ret);
}
diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c
index 34d0f645e35..d0be23dc8f8 100644
--- a/dlls/mshtml/htmlselect.c
+++ b/dlls/mshtml/htmlselect.c
@@ -36,9 +36,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
typedef struct {
+ HTMLElement element;
+
const IHTMLSelectElementVtbl *lpHTMLSelectElementVtbl;
- HTMLElement *element;
nsIDOMHTMLSelectElement *nsselect;
} HTMLSelectElement;
@@ -70,7 +71,7 @@ static HRESULT WINAPI HTMLSelectElement_QueryInterface(IHTMLSelectElement *iface
return S_OK;
}
- hres = HTMLElement_QI(This->element, riid, ppv);
+ hres = HTMLElement_QI(&This->element, riid, ppv);
if(FAILED(hres))
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
@@ -83,7 +84,7 @@ static ULONG WINAPI HTMLSelectElement_AddRef(IHTMLSelectElement *iface)
TRACE("(%p)\n", This);
- return IHTMLDocument2_AddRef(HTMLDOC(This->element->node.doc));
+ return IHTMLDocument2_AddRef(HTMLDOC(This->element.node.doc));
}
static ULONG WINAPI HTMLSelectElement_Release(IHTMLSelectElement *iface)
@@ -92,7 +93,7 @@ static ULONG WINAPI HTMLSelectElement_Release(IHTMLSelectElement *iface)
TRACE("(%p)\n", This);
- return IHTMLDocument2_Release(HTMLDOC(This->element->node.doc));
+ return IHTMLDocument2_Release(HTMLDOC(This->element.node.doc));
}
static HRESULT WINAPI HTMLSelectElement_GetTypeInfoCount(IHTMLSelectElement *iface, UINT *pctinfo)
@@ -386,19 +387,20 @@ static const IHTMLSelectElementVtbl HTMLSelectElementVtbl = {
HTMLSelectElement_tags
};
-void HTMLSelectElement_Create(HTMLElement *element)
+HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement *nselem)
{
HTMLSelectElement *ret = mshtml_alloc(sizeof(HTMLSelectElement));
nsresult nsres;
ret->lpHTMLSelectElementVtbl = &HTMLSelectElementVtbl;
- ret->element = element;
- nsres = nsIDOMHTMLElement_QueryInterface(element->nselem, &IID_nsIDOMHTMLSelectElement,
+ nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLSelectElement,
(void**)&ret->nsselect);
if(NS_FAILED(nsres))
ERR("Could not get nsIDOMHTMLSelectElement interfce: %08x\n", nsres);
- element->impl = (IUnknown*)HTMLSELECT(ret);
- element->destructor = HTMLSelectElement_destructor;
+ ret->element.impl = (IUnknown*)HTMLSELECT(ret);
+ ret->element.destructor = HTMLSelectElement_destructor;
+
+ return &ret->element;
}
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 7e8337e2fe2..644fe1b85c5 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -419,7 +419,7 @@ HTMLElement *HTMLElement_Create(nsIDOMNode*);
HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
-void HTMLSelectElement_Create(HTMLElement*);
+HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
void HTMLTextAreaElement_Create(HTMLElement*);
void HTMLElement2_Init(HTMLElement*);