mshtml: Implement HTMLTitleElement's text property.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2022-07-27 21:33:35 +03:00 committed by Alexandre Julliard
parent b4adbb4dc0
commit 1381ced8ec
2 changed files with 36 additions and 4 deletions

View file

@ -103,15 +103,29 @@ static HRESULT WINAPI HTMLTitleElement_Invoke(IHTMLTitleElement *iface, DISPID d
static HRESULT WINAPI HTMLTitleElement_put_text(IHTMLTitleElement *iface, BSTR v)
{
HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
nsAString text;
nsresult nsres;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_InitDepend(&text, v);
nsres = nsIDOMNode_SetTextContent(This->element.node.nsnode, &text);
nsAString_Finish(&text);
return map_nsresult(nsres);
}
static HRESULT WINAPI HTMLTitleElement_get_text(IHTMLTitleElement *iface, BSTR *p)
{
HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsAString text;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsAString_InitDepend(&text, NULL);
nsres = nsIDOMNode_GetTextContent(This->element.node.nsnode, &text);
return return_nsstr(nsres, &text, p);
}
static const IHTMLTitleElementVtbl HTMLTitleElementVtbl = {

View file

@ -533,6 +533,24 @@ sync_test("title", function() {
elem.title = "test";
ok(elem.title === "test", "div.title = " + elem.title);
ok(elem.getAttribute("title") === "test", "title attribute = " + elem.getAttribute("title"));
var orig = document.title;
document.title = "w i n e test";
var title = document.getElementsByTagName("title")[0];
ok(title.text === "w i n e test", "<title> element text = " + title.text);
title.text = "winetest";
ok(title.text === "winetest", "<title> element text after change = " + title.text);
ok(document.title === "winetest", "document.title after <title> change = " + document.title);
elem = document.createElement("title");
ok(elem.text === "", "detached <title> element text = " + elem.text);
elem.text = "foobar";
ok(elem.text === "foobar", "detached <title> element text after change = " + elem.text);
ok(document.title === "winetest", "document.title after detached <title> change = " + document.title);
title.parentNode.replaceChild(elem, title);
ok(document.title === "foobar", "document.title after <title> replaced = " + document.title);
document.title = orig;
});
sync_test("disabled", function() {