Commit 7858cc01 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Add IHTMLDocument7::createElementNS implementation.

parent 3dc6d9d9
......@@ -3288,8 +3288,39 @@ static HRESULT WINAPI HTMLDocument7_getElementsByTagNameNS(IHTMLDocument7 *iface
static HRESULT WINAPI HTMLDocument7_createElementNS(IHTMLDocument7 *iface, VARIANT *pvarNS, BSTR bstrTag, IHTMLElement **newElem)
{
HTMLDocument *This = impl_from_IHTMLDocument7(iface);
FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrTag), newElem);
return E_NOTIMPL;
nsIDOMElement *dom_element;
HTMLElement *element;
nsAString ns, tag;
nsresult nsres;
HRESULT hres;
TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrTag), newElem);
if(!This->doc_node->nsdoc) {
FIXME("NULL nsdoc\n");
return E_FAIL;
}
if(pvarNS && V_VT(pvarNS) != VT_NULL && V_VT(pvarNS) != VT_BSTR)
FIXME("Unsupported namespace %s\n", debugstr_variant(pvarNS));
nsAString_InitDepend(&ns, pvarNS && V_VT(pvarNS) == VT_BSTR ? V_BSTR(pvarNS) : NULL);
nsAString_InitDepend(&tag, bstrTag);
nsres = nsIDOMHTMLDocument_CreateElementNS(This->doc_node->nsdoc, &ns, &tag, &dom_element);
nsAString_Finish(&ns);
nsAString_Finish(&tag);
if(NS_FAILED(nsres)) {
WARN("CreateElementNS failed: %08x\n", nsres);
return map_nsresult(nsres);
}
hres = HTMLElement_Create(This->doc_node, (nsIDOMNode*)dom_element, FALSE, &element);
nsIDOMElement_Release(dom_element);
if(FAILED(hres))
return hres;
*newElem = &element->IHTMLElement_iface;
return S_OK;
}
static HRESULT WINAPI HTMLDocument7_createAttributeNS(IHTMLDocument7 *iface, VARIANT *pvarNS,
......
......@@ -168,6 +168,25 @@ function test_getElementsByClassName() {
next_test();
}
function test_createElementNS() {
var svg_ns = "http://www.w3.org/2000/svg";
var elem;
elem = document.createElementNS(null, "test");
ok(elem.tagName === "test", "elem.tagName = " + elem.tagName);
elem = document.createElementNS(svg_ns, "test");
ok(elem.tagName === "test", "elem.tagName = " + elem.tagName);
elem = document.createElementNS(svg_ns, "svg");
ok(elem.tagName === "svg", "elem.tagName = " + elem.tagName);
elem = document.createElementNS("test", "svg");
ok(elem.tagName === "svg", "elem.tagName = " + elem.tagName);
next_test();
}
function test_query_selector() {
document.body.innerHTML = '<div class="class1">'
+ '<div class="class1"></div>'
......@@ -351,6 +370,7 @@ var tests = [
test_textContent,
test_ElementTraversal,
test_getElementsByClassName,
test_createElementNS,
test_head,
test_iframe,
test_anchor,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment