summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-composited-scrolling-004-crash.html
blob: ee5ad2f41ae3a7b99f65c38de00e03595c380e9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html class="test-wait">
<title>Tests that scrolling doesn't crash renderer when scroller's content no longer overflows, and target precedes scroller in DOM</title>
<link rel="author" href="mailto:xiaochengh@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/">

<style>
#scroller {
  margin-top: 200px;
  height: 200px;
  overflow-y: scroll;
}

#anchor {
  anchor-name: --a;
}

#spacer {
  height: 400px;
}

#target {
  position: fixed;
  top: anchor(--a bottom);
  left: anchor(--a left);
  position-anchor: --a;
}
</style>

<div id="target">target</div>
<div id="scroller">
  <div id="spacer"></div>
  <div id="anchor">anchor</div>
</div>

<script type="module">
const raf = () => new Promise(resolve => requestAnimationFrame(resolve));

await raf();
await raf();

spacer.style.height = '0';

document.documentElement.classList.remove('test-wait');
</script>
</html>