mshtml: Add IHTMLElement6::hasAttribute implementation.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
83fc6f0ee3
commit
696e8faaa9
|
@ -202,6 +202,22 @@ HRESULT elem_string_attr_setter(HTMLElement *elem, const WCHAR *name, const WCHA
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static VARIANT_BOOL element_has_attribute(HTMLElement *element, const WCHAR *name)
|
||||
{
|
||||
nsAString name_str;
|
||||
cpp_bool r;
|
||||
nsresult nsres;
|
||||
|
||||
if(!element->dom_element) {
|
||||
WARN("no DOM element\n");
|
||||
return VARIANT_FALSE;
|
||||
}
|
||||
|
||||
nsAString_InitDepend(&name_str, name);
|
||||
nsres = nsIDOMElement_HasAttribute(element->dom_element, &name_str, &r);
|
||||
return variant_bool(NS_SUCCEEDED(nsres) && r);
|
||||
}
|
||||
|
||||
HRESULT get_readystate_string(READYSTATE readystate, BSTR *p)
|
||||
{
|
||||
static const LPCWSTR readystate_strs[] = {
|
||||
|
@ -4453,11 +4469,14 @@ static HRESULT WINAPI HTMLElement6_removeAttributeNode(IHTMLElement6 *iface, IHT
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement6_hasAttribute(IHTMLElement6 *iface, BSTR name, VARIANT_BOOL *pfHasAttribute)
|
||||
static HRESULT WINAPI HTMLElement6_hasAttribute(IHTMLElement6 *iface, BSTR name, VARIANT_BOOL *p)
|
||||
{
|
||||
HTMLElement *This = impl_from_IHTMLElement6(iface);
|
||||
FIXME("(%p)->(%s %p)\n", This, debugstr_w(name), pfHasAttribute);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), p);
|
||||
|
||||
*p = element_has_attribute(This, name);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement6_getElementsByTagNameNS(IHTMLElement6 *iface, VARIANT *varNS, BSTR bstrLocalName, IHTMLElementCollection **pelColl)
|
||||
|
|
|
@ -468,3 +468,23 @@ sync_test("title", function() {
|
|||
ok(elem.title === "test", "div.title = " + elem.title);
|
||||
ok(elem.getAttribute("title") === "test", "title attribute = " + elem.getAttribute("title"));
|
||||
});
|
||||
|
||||
sync_test("hasAttribute", function() {
|
||||
document.body.innerHTML = '<div attr="test"></div>';
|
||||
var elem = document.body.firstChild, r;
|
||||
|
||||
r = elem.hasAttribute("attr");
|
||||
ok(r === true, "hasAttribute(attr) returned " + r);
|
||||
r = elem.hasAttribute("attr2");
|
||||
ok(r === false, "hasAttribute(attr2) returned " + r);
|
||||
|
||||
elem.setAttribute("attr2", "abc");
|
||||
r = elem.hasAttribute("attr2");
|
||||
todo_wine.
|
||||
ok(r === true, "hasAttribute(attr2) returned " + r);
|
||||
|
||||
elem.removeAttribute("attr");
|
||||
r = elem.hasAttribute("attr");
|
||||
todo_wine.
|
||||
ok(r === false, "hasAttribute(attr) returned " + r);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue