<!DOCTYPE html>
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<div id="a"><div id="host"><div id="child"></div></div></div>
<script>
test(() => {
const a = document.querySelector('#a');
const child = document.querySelector('#child');
const host = document.querySelector('#host');
const sr = host.attachShadow({ mode: 'open' });
sr.appendChild(document.createElement('slot'));
document.body.offsetLeft;
child.remove();
host.remove();
a.appendChild(child);
document.body.offsetLeft;
child.appendChild(host);
a.remove();
}, "crbug.com/849599. Cyclic detach should not happen.");
</script>