summaryrefslogtreecommitdiffstats
path: root/layout/reftests/bugs/398682-1.html
blob: 0e5793b352323408ec83cd1c3995b374320570f9 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<script>

function boom()
{
  // Only this exact number of calls to bounce() triggers the bug,
  // but changing the depth of the document changes the number of
  // bounce() calls needed.  For example, removing the 'p' tag
  // makes it so one additional bounce() is needed.

  for (var i = 0; i < 7; ++i)
    bounce();

  var tr = document.getElementById("tr"); 
  tr.style.display = "none";
  document.documentElement.offsetHeight;
  bounce();
  document.documentElement.offsetHeight;
  tr.style.display = "";

  document.documentElement.offsetHeight;

  var td = document.getElementById("td");
  td.style.display = "none";
  document.documentElement.offsetHeight;
  bounce();
  document.documentElement.offsetHeight;
  td.style.display = "";
}


function bounce()
{
    var docElem = document.documentElement;
    var docElemChildren = [];
    while (docElem.firstChild) {
        docElemChildren.push(docElem.firstChild);
        docElem.firstChild.remove();
    }

    for (var i = 0; i < docElemChildren.length; ++i)
        docElem.appendChild(docElemChildren[i]);
}

</script>

<style type="text/css">
#a { color: orange; }
#b { color: blue; }
</style>

</head>

<body onload="boom();">
  <table border="10"><tr id="tr"><td id="td">
    <p><span id="a">a</span><span id="b">b</span></p>
  </td></tr></table>
</body>

</html>