<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://drafts.csswg.org/resize-observer/#calculate-depth-for-node">
<body>
<div id="host"></div>
<script>
let didSeeError = false;
window.onerror = (message, source, lineno, colno, error) => {
  didSeeError = true;
}

async_test(t => {
  let host = document.querySelector('#host');
  let observer = new ResizeObserver(t.step_func(() => {
    let root = host.attachShadow({mode:'open'});
    let child = root.appendChild(document.createElement('div'));
    new ResizeObserver(() => {}).observe(child);
    requestAnimationFrame(t.step_func_done(() => { assert_false(didSeeError); }));
  }));
  observer.observe(host);
}, '"Calculate depth for node" algorithm with Shadow DOM');


</script>
</body>
