summaryrefslogtreecommitdiffstats
path: root/layout/reftests/cssom/computed-style-cross-window-ref.html
blob: 01724fefbcf4909e1579b53c79b202660fd8db7f (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
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE HTML>
<title>getComputedStyle across windows</title>
<style>
p { color: blue }

div { margin: 1em 0 }
</style>

<script>

var gRunCount = 2;

function run() {
  if (--gRunCount != 0)
    return;

  var i = document.getElementById("i");

  var pout = document.getElementById("out");
  var poutnone = document.getElementById("outnone");
  var poutdet = document.createElement("p");
  var pin = i.contentDocument.getElementsByTagName("p")[0];
  var pinnone = i.contentDocument.getElementsByTagName("p")[1];
  var pindet = i.contentDocument.createElement("p");

  document.getElementById("res1").style.color =
    window.getComputedStyle(pin, "").color;

  document.getElementById("res2").style.color =
    i.contentWindow.getComputedStyle(pout, "").color;

  document.getElementById("res3").style.color =
    window.getComputedStyle(pinnone, "").color;

  document.getElementById("res4").style.color =
    i.contentWindow.getComputedStyle(poutnone, "").color;

  document.getElementById("res5").style.color =
    window.getComputedStyle(pindet, "").color;

  document.getElementById("res6").style.color =
    i.contentWindow.getComputedStyle(poutdet, "").color;
}

</script>
<body onload="run()">

<p id="out">This is a paragraph outside the iframe.</p>
<div style="display:none"><p id="outnone">This is a paragraph outside the iframe.</p></div>

<iframe id="i" src="computed-style-cross-window-inner.html" onload="run()"></iframe>

<div style="color:fuchsia">This paragraph is the color that
outerWindow.getComputedStyle says the paragraph inside the iframe
is.</div>

<div style="color:blue">This paragraph is the color that
iframeWindow.getComputedStyle says the paragraph outside the iframe
is.</div>

<div style="color:fuchsia">This paragraph is the color that
outerWindow.getComputedStyle says the display:none paragraph inside the
iframe is.</div>

<div style="color:blue">This paragraph is the color that
iframeWindow.getComputedStyle says the display:none paragraph outside
the iframe is.</div>

<div style="color:blue">This paragraph is the color that
outerWindow.getComputedStyle says the detached paragraph inside the
iframe is.</div>

<div style="color:fuchsia">This paragraph is the color that
iframeWindow.getComputedStyle says the detached paragraph outside
the iframe is.</div>