summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/tabs/file_observe_height_changes.html
blob: 18b0fdf25192e3a28c5b7957fba39296662e0ef1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<meta charset="utf-8">
<style>
  /* This lets us measure the height of the viewport
     by measuring documentElement.offsetHeight. */
  html { height: 100vh }
</style>
<script>
  let mostRecentHeight = 0;
  let heightChanges = 0;
  function checkDocumentHeight() {
    let curHeight = document.documentElement.offsetHeight;
    if (curHeight != mostRecentHeight) {
      mostRecentHeight = curHeight;
      document.body.innerText = heightChanges++;
    }
    requestAnimationFrame(checkDocumentHeight);
  }
</script>
<body onload="checkDocumentHeight();">
</body>