<!DOCTYPE html>
<title>Document-detached use of DOMParser</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<body>
<script>
test(() => {
var iframe = document.createElement("iframe");
iframe.src = "data:text/html,<b>";
document.body.appendChild(iframe);
var Parser = iframe.contentWindow.DOMParser;
iframe.remove();
var d = new Parser();
assert_true(d != null);
var detached = d.parseFromString("no crash", "text/html");
assert_equals(detached.defaultView, null);
});
</script>
</body>