2 <p>Test of createContextualFragment from a Range whose context is an HTML document without a body. If the test succeeds you will see the word
"PASS" below.
</p>
6 testRunner
.dumpAsText();
8 var doc
= document
.implementation
.createHTMLDocument();
9 var div
= doc
.createElement('div');
10 doc
.replaceChild(div
, doc
.documentElement
);
12 var range
= doc
.createRange();
13 var fragment
= range
.createContextualFragment('<p id="fragment">Inserted fragment</p>');
14 div
.appendChild(fragment
);
15 var p
= doc
.getElementById('fragment');
17 var result
= document
.getElementById('result');
18 result
.textContent
= (p
&& p
.parentElement
=== div
&& p
.namespaceURI
=== 'http://www.w3.org/1999/xhtml') ? 'PASS' : 'FAIL';