<!DOCTYPE>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<body>
<script>
test( () => {
const iframe = document.createElement('iframe')
document.body.appendChild(iframe);
const button = document.createElement('button');
iframe.contentDocument.body.appendChild(button);
button.id = 'button';
button.onfocus = () => {
// This will detach the iframe's document from its frame before
// reattaching to the DOM and creating a new document. Ensure nothing
// touches the cleared frame.
document.body.appendChild(iframe);
};
// Cause the button to be focused and scrolled into view.
iframe.contentWindow.location.hash = 'button';
}, "Detaching document during scroll to fragment doesn't crash");
</script>
</body>