mshtml: Restructure element removeAttribute.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2021-12-01 15:41:51 +02:00 committed by Alexandre Julliard
parent 368199c640
commit d224a2a881
1 changed files with 30 additions and 29 deletions

View File

@ -1197,18 +1197,13 @@ static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strA
LONG lFlags, VARIANT_BOOL *pfSuccess) LONG lFlags, VARIANT_BOOL *pfSuccess)
{ {
HTMLElement *This = impl_from_IHTMLElement(iface); HTMLElement *This = impl_from_IHTMLElement(iface);
compat_mode_t compat_mode = dispex_compat_mode(&This->node.event_target.dispex);
DISPID id; DISPID id;
HRESULT hres; HRESULT hres;
TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess); TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess);
if(dispex_compat_mode(&This->node.event_target.dispex) >= COMPAT_MODE_IE8) { if(compat_mode < COMPAT_MODE_IE8 || !This->dom_element) {
*pfSuccess = element_has_attribute(This, strAttributeName);
if(*pfSuccess)
return element_remove_attribute(This, strAttributeName);
return S_OK;
}
hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, strAttributeName, hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, strAttributeName,
lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &id); lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &id);
if(hres == DISP_E_UNKNOWNNAME) { if(hres == DISP_E_UNKNOWNNAME) {
@ -1239,6 +1234,12 @@ static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strA
return remove_attribute(&This->node.event_target.dispex, id, pfSuccess); return remove_attribute(&This->node.event_target.dispex, id, pfSuccess);
} }
*pfSuccess = element_has_attribute(This, strAttributeName);
if(*pfSuccess)
return element_remove_attribute(This, strAttributeName);
return S_OK;
}
static HRESULT WINAPI HTMLElement_put_className(IHTMLElement *iface, BSTR v) static HRESULT WINAPI HTMLElement_put_className(IHTMLElement *iface, BSTR v)
{ {
HTMLElement *This = impl_from_IHTMLElement(iface); HTMLElement *This = impl_from_IHTMLElement(iface);