mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
mshtml: Also get dispid by element name & id in HTMLElementCollection.
This commit is contained in:
parent
3921454398
commit
9a9c5f9cdf
@ -205,6 +205,26 @@ static HRESULT WINAPI HTMLElementCollection_get__newEnum(IHTMLElementCollection
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static BOOL is_elem_id(HTMLElement *elem, LPCWSTR name)
|
||||
{
|
||||
BSTR elem_id;
|
||||
HRESULT hres;
|
||||
|
||||
hres = IHTMLElement_get_id(HTMLELEM(elem), &elem_id);
|
||||
if(FAILED(hres)){
|
||||
WARN("IHTMLElement_get_id failed: 0x%08x\n", hres);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(elem_id && !strcmpW(elem_id, name)) {
|
||||
SysFreeString(elem_id);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
SysFreeString(elem_id);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL is_elem_name(HTMLElement *elem, LPCWSTR name)
|
||||
{
|
||||
const PRUnichar *str;
|
||||
@ -376,7 +396,16 @@ static HRESULT HTMLElementCollection_get_dispid(IUnknown *iface, BSTR name, DWOR
|
||||
for(ptr = name; *ptr && isdigitW(*ptr); ptr++)
|
||||
idx = idx*10 + (*ptr-'0');
|
||||
|
||||
if(*ptr || idx >= This->len)
|
||||
if(*ptr) {
|
||||
/* the name contains alpha characters, so search by name & id */
|
||||
for(idx = 0; idx < This->len; ++idx) {
|
||||
if(is_elem_id(This->elems[idx], name) ||
|
||||
is_elem_name(This->elems[idx], name))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(idx >= This->len)
|
||||
return DISP_E_UNKNOWNNAME;
|
||||
|
||||
*dispid = DISPID_ELEMCOL_0 + idx;
|
||||
|
Loading…
Reference in New Issue
Block a user