diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 930568ab2c0..b71d7ed3fa5 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -1318,7 +1318,7 @@ static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v) TRACE("(%p)->(%s)\n", This, debugstr_w(v)); - if(!This->html_element) { + if(!This->dom_element) { VARIANT *var; HRESULT hres; @@ -1332,6 +1332,9 @@ static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v) return S_OK; } + if(!This->html_element) + return elem_string_attr_setter(This, L"title", v); + nsAString_InitDepend(&title_str, v); nsres = nsIDOMHTMLElement_SetTitle(This->html_element, &title_str); nsAString_Finish(&title_str); @@ -1349,7 +1352,7 @@ static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p) TRACE("(%p)->(%p)\n", This, p); - if(!This->html_element) { + if(!This->dom_element) { VARIANT *var; HRESULT hres; @@ -1366,6 +1369,9 @@ static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p) return S_OK; } + if(!This->html_element) + return elem_string_attr_getter(This, L"title", FALSE, p); + nsAString_Init(&title_str, NULL); nsres = nsIDOMHTMLElement_GetTitle(This->html_element, &title_str); return return_nsstr(nsres, &title_str, p); diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 7074b1f62f2..9cb9c6058a0 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -34,6 +34,7 @@ sync_test("elem_props", function() { test_exposed("doScroll", v < 11); test_exposed("readyState", v < 11); test_exposed("clientTop", true); + test_exposed("title", true); test_exposed("querySelectorAll", v >= 8); test_exposed("textContent", v >= 9); test_exposed("prefix", v >= 9); diff --git a/dlls/mshtml/tests/dom.js b/dlls/mshtml/tests/dom.js index b30d1a8fbed..f9d0873bb89 100644 --- a/dlls/mshtml/tests/dom.js +++ b/dlls/mshtml/tests/dom.js @@ -458,3 +458,13 @@ async_test("animation_frame", function() { }); ok(typeof(id) === "number", "id = " + id); }); + +sync_test("title", function() { + var elem = document.createElement("div"); + ok(elem.title === "", "div.title = " + elem.title); + todo_wine. + ok(elem.getAttribute("title") === null, "title attribute = " + elem.getAttribute("title")); + elem.title = "test"; + ok(elem.title === "test", "div.title = " + elem.title); + ok(elem.getAttribute("title") === "test", "title attribute = " + elem.getAttribute("title")); +});