Commit 23ae6e4e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Treat doctype nodes as comment nodes.

parent 292e2359
......@@ -387,6 +387,7 @@ static HRESULT WINAPI HTMLDOMNode_get_nodeType(IHTMLDOMNode *iface, LONG *p)
*p = 3;
break;
case COMMENT_NODE:
case DOCUMENT_TYPE_NODE:
*p = 8;
break;
case DOCUMENT_NODE:
......@@ -1103,6 +1104,8 @@ static HRESULT create_node(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDOMNod
if(FAILED(hres))
return hres;
break;
/* doctype nodes are represented as comment nodes (at least in quirks mode) */
case DOCUMENT_TYPE_NODE:
case COMMENT_NODE: {
HTMLElement *comment;
hres = HTMLCommentElement_Create(doc, nsnode, &comment);
......
......@@ -85,6 +85,10 @@ static const char emptydiv_str[] =
static const char noscript_str[] =
"<html><head><title>noscript test</title><noscript><style>.body { margin-right: 0px; }</style></noscript></head>"
"<body><noscript><div>test</div></noscript></body></html>";
static const char doctype_str[] =
"<!DOCTYPE html>"
"<html><head><title>emptydiv test</title></head>"
"<body><div id=\"divid\"></div></body></html>";
static WCHAR characterW[] = {'c','h','a','r','a','c','t','e','r',0};
static WCHAR texteditW[] = {'t','e','x','t','e','d','i','t',0};
......@@ -6558,6 +6562,24 @@ static void test_noscript(IHTMLDocument2 *doc)
IHTMLElement_Release(body);
}
static void test_doctype(IHTMLDocument2 *doc)
{
IHTMLDocument2 *doc_node;
IHTMLDOMNode *doctype;
int type;
doc_node = get_doc_node(doc);
doctype = get_first_child((IUnknown*)doc_node);
IHTMLDocument2_Release(doc_node);
type = get_node_type((IUnknown*)doctype);
ok(type == 8, "type = %d\n", type);
test_comment_text((IUnknown*)doctype, "<!DOCTYPE html>");
test_elem_type((IUnknown*)doctype, ET_COMMENT);
IHTMLDOMNode_Release(doctype);
}
static void test_null_write(IHTMLDocument2 *doc)
{
HRESULT hres;
......@@ -7106,6 +7128,7 @@ START_TEST(dom)
run_domtest(frameset_str, test_frameset);
run_domtest(emptydiv_str, test_docfrag);
run_domtest(doc_blank, test_replacechild_elems);
run_domtest(doctype_str, test_doctype);
CoUninitialize();
}
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