Jacek Caban : mshtml: Treat doctype nodes as comment nodes.
Alexandre Julliard
julliard at winehq.org
Thu Jan 17 14:48:50 CST 2013
Module: wine
Branch: master
Commit: 23ae6e4ec4627043fd3227d0bde080b60232790c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=23ae6e4ec4627043fd3227d0bde080b60232790c
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Jan 17 15:24:38 2013 +0100
mshtml: Treat doctype nodes as comment nodes.
---
dlls/mshtml/htmlnode.c | 3 +++
dlls/mshtml/tests/dom.c | 23 +++++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c
index cf22838..4269f6c 100644
--- a/dlls/mshtml/htmlnode.c
+++ b/dlls/mshtml/htmlnode.c
@@ -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);
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index d45a1fe..5ee0261 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -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();
}
More information about the wine-cvs
mailing list