From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmldoc.c | 27 +++++++++++++++++++++++++-- dlls/mshtml/tests/documentmode.js | 24 ++++++++++++++++++++++-- dlls/mshtml/tests/dom.c | 15 +++++++++++++++ 3 files changed, 62 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 8c26292ee85..ec77b1a759c 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -5829,13 +5829,36 @@ HRESULT create_document_node(nsIDOMDocument *nsdoc, GeckoBrowser *browser, HTMLI return S_OK; }
+static void DocumentFragment_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + static const DISPID document3_dispids[] = { + DISPID_IHTMLDOCUMENT3_ATTACHEVENT, + DISPID_IHTMLDOCUMENT3_DETACHEVENT, + DISPID_UNKNOWN + }; + + if(mode < COMPAT_MODE_IE9) { + HTMLDocumentNode_init_dispex_info(info, mode); + dispex_info_add_interface(info, IHTMLDocument4_tid, NULL); + dispex_info_add_interface(info, IHTMLDocument5_tid, NULL); + } else if(mode < COMPAT_MODE_IE11) { + dispex_info_add_dispids(info, IHTMLDocument3_tid, document3_dispids); + } +} + +static const tid_t DocumentFragment_iface_tids[] = { + IHTMLDOMNode_tid, + IHTMLDOMNode2_tid, + IDocumentSelector_tid, + 0 +}; dispex_static_data_t DocumentFragment_dispex = { .id = PROT_DocumentFragment, .prototype_id = PROT_Node, .vtbl = &HTMLDocument_event_target_vtbl.dispex_vtbl, .disp_tid = DispHTMLDocument_tid, - .iface_tids = HTMLDocumentNode_iface_tids, - .init_info = HTMLDocumentNode_init_dispex_info, + .iface_tids = DocumentFragment_iface_tids, + .init_info = DocumentFragment_init_dispex_info, };
static HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *doc_node, HTMLDocumentNode **ret) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index a943fcbe532..c98fd072e87 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -607,13 +607,32 @@ sync_test("docfrag_props", function() {
function test_exposed(prop, expect) { if(expect) - ok(prop in docfrag, prop + " not found in document fragent."); + ok(prop in docfrag, prop + " not found in document fragment."); else - ok(!(prop in docfrag), prop + " found in document fragent."); + ok(!(prop in docfrag), prop + " found in document fragment."); }
var v = document.documentMode;
+ test_exposed("attachEvent", v < 11); + test_exposed("detachEvent", v < 11); + test_exposed("createStyleSheet", v < 9); + test_exposed("fileSize", v < 9); + test_exposed("selection", v < 9); + test_exposed("doctype", v < 9); + test_exposed("onstorage", v < 9); + test_exposed("textContent", v >= 9); + test_exposed("prefix", v >= 9); + test_exposed("ownerDocument", true); + test_exposed("removeNode", true); + test_exposed("replaceNode", true); + test_exposed("swapNode", true); + test_exposed("defaultView", false); + test_exposed("head", false); + test_exposed("addEventListener", v >= 9); + test_exposed("removeEventListener", v >= 9); + test_exposed("dispatchEvent", v >= 9); + test_exposed("createEvent", false); test_exposed("compareDocumentPosition", v >= 9); });
@@ -3746,6 +3765,7 @@ sync_test("prototype props", function() { ["onpropertychange",11], ["onrowenter",11], ["onrowexit",11], ["onrowsdelete",11], ["onrowsinserted",11], "recalc", ["releaseEvents",11], "rootElement", "toString", ["visibilityState",10] ]); + check(DocumentFragment, [ ["attachEvent",9,10], ["detachEvent",9,10], "querySelector", "querySelectorAll", "removeNode", "replaceNode", "swapNode" ]); check(DocumentType, [ "entities", "internalSubset", "name", "notations", "publicId", "systemId" ]); check(Element, [ "childElementCount", "clientHeight", "clientLeft", "clientTop", "clientWidth", ["fireEvent",9,10], "firstElementChild", diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 65085f8cef5..af03e660fe5 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -103,6 +103,9 @@ static const char frameset_str[] = static const char emptydiv_str[] = "<html><head><title>emptydiv test</title></head>" "<body><div id="divid"></div></body></html>"; +static const char emptydiv_ie9_str[] = + "<html><head><meta http-equiv="x-ua-compatible" content="IE=9"/><title>emptydiv test</title></head>" + "<body><div id="divid"></div></body></html>"; 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>"; @@ -11085,6 +11088,8 @@ static void test_docfrag(IHTMLDocument2 *doc) frag = create_docfrag(doc);
test_disp((IUnknown*)frag, &DIID_DispHTMLDocument, &CLSID_HTMLDocument, L"[object]"); + if(is_ie9plus) + test_ifaces((IUnknown*)frag, doc_node_iids);
frag_body = (void*)0xdeadbeef; hres = IHTMLDocument2_get_body(frag, &frag_body); @@ -11118,6 +11123,11 @@ static void test_docfrag(IHTMLDocument2 *doc) test_node_append_child_discard((IUnknown*)div, (IUnknown*)frag); IHTMLElement_Release(div);
+ if(compat_mode >= COMPAT_IE9) { + IHTMLDocument2_Release(frag); + return; + } + hres = IHTMLDocument2_get_all(doc, &col); ok(hres == S_OK, "get_all failed: %08lx\n", hres); test_elem_collection((IUnknown*)col, all_types, ARRAY_SIZE(all_types)); @@ -12262,6 +12272,11 @@ START_TEST(dom) run_domtest(emptydiv_str, test_docfrag); run_domtest(doc_blank, test_replacechild_elems); run_domtest(doctype_str, test_doctype); + if(is_ie9plus) { + compat_mode = COMPAT_IE9; + run_domtest(emptydiv_ie9_str, test_docfrag); + compat_mode = COMPAT_NONE; + }
test_quirks_mode(); test_document_mode_lock();