<script>
if (window.testRunner)
  testRunner.dumpAsText();

try {
  var xmld = new DOMParser().parseFromString( "<doc/>", "text/xml");

  var fragment = document.createDocumentFragment();
  fragment.appendChild(document.createTextNode("1"));
  fragment.appendChild(document.createTextNode("2"));

  var importedFragment = xmld.importNode(fragment, true);
  xmld.firstChild.appendChild(importedFragment);
  if (xmld.firstChild.textContent != "12")
    throw "wrong imported DOM tree: '" + xmld.firstChild.textContent + "'";

  document.write("<div>SUCCESS</div>");
} catch (ex) {
  document.write("<div>" + ex + "</div>");
}
</script>
