diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c
index 7869a8e628b..b2c10f725bb 100644
--- a/dlls/mshtml/htmlselect.c
+++ b/dlls/mshtml/htmlselect.c
@@ -590,14 +590,58 @@ static const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl = {
HTMLOptionElementFactory_create
};
+static inline HTMLOptionElementFactory *HTMLOptionElementFactory_from_DispatchEx(DispatchEx *iface)
+{
+ return CONTAINING_RECORD(iface, HTMLOptionElementFactory, dispex);
+}
+
+static HRESULT HTMLOptionElementFactory_value(DispatchEx *dispex, LCID lcid,
+ WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei,
+ IServiceProvider *caller)
+{
+ HTMLOptionElementFactory *This = HTMLOptionElementFactory_from_DispatchEx(dispex);
+ unsigned int i, argc = params->cArgs - params->cNamedArgs;
+ IHTMLOptionElement *opt;
+ VARIANT empty, *arg[4];
+ HRESULT hres;
+
+ if(flags != DISPATCH_CONSTRUCT) {
+ FIXME("flags %x not supported\n", flags);
+ return E_NOTIMPL;
+ }
+
+ V_VT(res) = VT_NULL;
+ V_VT(&empty) = VT_EMPTY;
+
+ for(i = 0; i < ARRAY_SIZE(arg); i++)
+ arg[i] = argc > i ? ¶ms->rgvarg[params->cArgs - 1 - i] : ∅
+
+ hres = IHTMLOptionElementFactory_create(&This->IHTMLOptionElementFactory_iface,
+ *arg[0], *arg[1], *arg[2], *arg[3], &opt);
+ if(FAILED(hres))
+ return hres;
+
+ V_VT(res) = VT_DISPATCH;
+ V_DISPATCH(res) = (IDispatch*)opt;
+
+ return S_OK;
+}
+
static const tid_t HTMLOptionElementFactory_iface_tids[] = {
IHTMLOptionElementFactory_tid,
0
};
+static const dispex_static_data_vtbl_t HTMLOptionElementFactory_dispex_vtbl = {
+ HTMLOptionElementFactory_value,
+ NULL,
+ NULL,
+ NULL
+};
+
static dispex_static_data_t HTMLOptionElementFactory_dispex = {
L"Function",
- NULL,
+ &HTMLOptionElementFactory_dispex_vtbl,
IHTMLOptionElementFactory_tid,
HTMLOptionElementFactory_iface_tids,
HTMLElement_init_dispex_info
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index ea5b2108100..0c065a2da7e 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2190,10 +2190,12 @@ static void _set_object_name(unsigned line, IHTMLElement *elem, const WCHAR *nam
static IHTMLOptionElement *_create_option_elem(unsigned line, IHTMLDocument2 *doc,
const WCHAR *txt, const WCHAR *val)
{
+ VARIANT text, value, empty, option_var, args[2];
+ DISPPARAMS dp = { args, NULL, 2, 0 };
IHTMLOptionElementFactory *factory;
IHTMLOptionElement *option;
IHTMLWindow2 *window;
- VARIANT text, value, empty;
+ IDispatch *disp;
HRESULT hres;
hres = IHTMLDocument2_get_parentWindow(doc, &window);
@@ -2211,6 +2213,24 @@ static IHTMLOptionElement *_create_option_elem(unsigned line, IHTMLDocument2 *do
V_BSTR(&value) = SysAllocString(val);
V_VT(&empty) = VT_EMPTY;
+ hres = IHTMLOptionElementFactory_QueryInterface(factory, &IID_IDispatch, (void**)&disp);
+ ok_(__FILE__,line)(hres == S_OK, "Could not get IDispatch: %08x\n", hres);
+
+ args[1] = text;
+ args[0] = value;
+ hres = IDispatch_Invoke(disp, DISPID_VALUE, &IID_NULL, 0, DISPATCH_CONSTRUCT, &dp, &option_var, NULL, NULL);
+ IDispatch_Release(disp);
+ ok_(__FILE__,line)(hres == S_OK, "Invoke(DISPID_VALUE) returned: %08x\n", hres);
+ ok_(__FILE__,line)(V_VT(&option_var) == VT_DISPATCH, "VT(option_var) = %d\n", V_VT(&option_var));
+ hres = IDispatch_QueryInterface(V_DISPATCH(&option_var), &IID_IHTMLOptionElement, (void**)&option);
+ ok_(__FILE__,line)(hres == S_OK, "Could not get IHTMLOptionElement: %08x\n", hres);
+ VariantClear(&option_var);
+
+ _test_option_text(line, option, txt);
+ _test_option_value(line, option, val);
+ _test_option_selected(line, option, VARIANT_FALSE);
+ IHTMLOptionElement_Release(option);
+
hres = IHTMLOptionElementFactory_create(factory, text, value, empty, empty, &option);
ok_(__FILE__,line) (hres == S_OK, "create failed: %08x\n", hres);