Jacek Caban (@jacek) commented about dlls/mshtml/htmldoc.c:
- nsAString nsstr;
- nsresult nsres;
- nsAString_InitDepend(&nsstr, id);
- nsres = nsIDOMHTMLDocument_GetElementById(nsdoc, &nsstr, &nselem);
- nsAString_Finish(&nsstr);
- if(NS_FAILED(nsres))
return map_nsresult(nsres);
- if(!nselem)
return DISP_E_UNKNOWNNAME;
- nsAString_InitDepend(&nsstr, L"name");
- nsIDOMElement_HasAttribute(nselem, &nsstr, &has_name);
- nsIDOMElement_Release(nselem);
- nsAString_Finish(&nsstr);
- return has_name ? S_OK : DISP_E_UNKNOWNNAME;
This looks suspicious and quick testing doesn't confirm your theory. If I add name attribute to <div> from your test, it still passes on Windows, but not with your patches.