diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 8cee880b935..60306813af8 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -5197,6 +5197,7 @@ static HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *do
HTMLDOMNode_Init(doc_node, &doc_frag->node, nsnode, &HTMLDocumentNode_dispex);
doc_frag->node.vtbl = &HTMLDocumentFragmentImplVtbl;
+ doc_frag->document_mode = lock_document_mode(doc_node);
*ret = doc_frag;
return S_OK;
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index 663cce74b37..aa5954bf334 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -70,6 +70,23 @@ function test_doc_props() {
next_test();
}
+function test_docfrag_props() {
+ var docfrag = document.createDocumentFragment();
+
+ function test_exposed(prop, expect) {
+ if(expect)
+ ok(prop in docfrag, prop + " not found in document fragent.");
+ else
+ ok(!(prop in docfrag), prop + " found in document fragent.");
+ }
+
+ var v = document.documentMode;
+
+ test_exposed("compareDocumentPosition", v >= 9);
+
+ next_test();
+}
+
function test_window_props() {
function test_exposed(prop, expect) {
if(expect)
@@ -247,6 +264,7 @@ var tests = [
test_iframe_doc_mode,
test_elem_props,
test_doc_props,
+ test_docfrag_props,
test_window_props,
test_javascript,
test_xhr_props,