diff --git a/dlls/mshtml/htmlattr.c b/dlls/mshtml/htmlattr.c index 0302ee9a56b..446cb6f5894 100644 --- a/dlls/mshtml/htmlattr.c +++ b/dlls/mshtml/htmlattr.c @@ -296,8 +296,13 @@ static HRESULT WINAPI HTMLDOMAttribute2_get_name(IHTMLDOMAttribute2 *iface, BSTR static HRESULT WINAPI HTMLDOMAttribute2_put_value(IHTMLDOMAttribute2 *iface, BSTR v) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + VARIANT var; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + V_VT(&var) = VT_BSTR; + V_BSTR(&var) = v; + return IHTMLDOMAttribute_put_nodeValue(&This->IHTMLDOMAttribute_iface, var); } static HRESULT WINAPI HTMLDOMAttribute2_get_value(IHTMLDOMAttribute2 *iface, BSTR *p) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index bc60ff003b9..b9f79351f4f 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -4762,6 +4762,20 @@ static void _put_attr_node_value(unsigned line, IHTMLDOMAttribute *attr, VARIANT ok_(__FILE__,line) (hres == S_OK, "put_nodeValue failed: %08x\n", hres); } +#define put_attr_value(a,b) _put_attr_value(__LINE__,a,b) +static void _put_attr_value(unsigned line, IHTMLDOMAttribute *attr, const char *value) +{ + IHTMLDOMAttribute2 *attr2 = _get_attr2_iface(line, (IUnknown*)attr); + BSTR str = a2bstr(value); + HRESULT hres; + + hres = IHTMLDOMAttribute2_put_value(attr2, str); + ok_(__FILE__,line) (hres == S_OK, "put_nodeValue failed: %08x\n", hres); + + IHTMLDOMAttribute2_Release(attr2); + SysFreeString(str); +} + #define get_window_doc(e) _get_window_doc(__LINE__,e) static IHTMLDocument2 *_get_window_doc(unsigned line, IHTMLWindow2 *window) { @@ -8385,6 +8399,12 @@ static void test_attr(IHTMLElement *elem) ok(!strcmp_wa(V_BSTR(&v), "divid2"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v))); VariantClear(&v); + put_attr_value(attr, "divid3"); + + get_attr_node_value(attr, &v, VT_BSTR); + ok(!strcmp_wa(V_BSTR(&v), "divid3"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); + IHTMLDOMAttribute_Release(attr); attr = get_elem_attr_node((IUnknown*)elem, "emptyattr", TRUE); @@ -8420,6 +8440,11 @@ static void test_attr(IHTMLElement *elem) get_attr_node_value(attr, &v, VT_I4); ok(V_I4(&v) == 150, "V_I4(v) = %d\n", V_I4(&v)); + put_attr_value(attr, "160"); + get_attr_node_value(attr, &v, VT_BSTR); + ok(!strcmp_wa(V_BSTR(&v), "160"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); + IHTMLDOMAttribute_Release(attr); attr = get_elem_attr_node((IUnknown*)elem, "tabIndex", TRUE);