|
1 <!DOCTYPE HTML> |
|
2 <html class="reftest-wait"> |
|
3 <title>getComputedStyle across windows</title> |
|
4 <style> |
|
5 p { color: blue } |
|
6 |
|
7 div { margin: 1em 0 } |
|
8 </style> |
|
9 |
|
10 <script> |
|
11 |
|
12 var gRunCount = 2; |
|
13 |
|
14 function run() { |
|
15 if (--gRunCount != 0) |
|
16 return; |
|
17 |
|
18 var i = document.getElementById("i"); |
|
19 |
|
20 var pout = document.getElementById("out"); |
|
21 var poutnone = document.getElementById("outnone"); |
|
22 var poutdet = document.createElement("p"); |
|
23 var pin = i.contentDocument.getElementsByTagName("p")[0]; |
|
24 var pinnone = i.contentDocument.getElementsByTagName("p")[1]; |
|
25 var pindet = i.contentDocument.createElement("p"); |
|
26 |
|
27 document.getElementById("res1").style.color = |
|
28 window.getComputedStyle(pin, "").color; |
|
29 |
|
30 document.getElementById("res2").style.color = |
|
31 i.contentWindow.getComputedStyle(pout, "").color; |
|
32 |
|
33 document.getElementById("res3").style.color = |
|
34 window.getComputedStyle(pinnone, "").color; |
|
35 |
|
36 document.getElementById("res4").style.color = |
|
37 i.contentWindow.getComputedStyle(poutnone, "").color; |
|
38 |
|
39 document.getElementById("res5").style.color = |
|
40 window.getComputedStyle(pindet, "").color; |
|
41 |
|
42 document.getElementById("res6").style.color = |
|
43 i.contentWindow.getComputedStyle(poutdet, "").color; |
|
44 |
|
45 document.documentElement.removeAttribute("class"); |
|
46 } |
|
47 |
|
48 </script> |
|
49 <body onload="run()"> |
|
50 |
|
51 <p id="out">This is a paragraph outside the iframe.</p> |
|
52 <div style="display:none"><p id="outnone">This is a paragraph outside the iframe.</p></div> |
|
53 |
|
54 <iframe id="i" src="computed-style-cross-window-inner.html" onload="run()"></iframe> |
|
55 |
|
56 <div id="res1">This paragraph is the color that |
|
57 outerWindow.getComputedStyle says the paragraph inside the iframe |
|
58 is.</div> |
|
59 |
|
60 <div id="res2">This paragraph is the color that |
|
61 iframeWindow.getComputedStyle says the paragraph outside the iframe |
|
62 is.</div> |
|
63 |
|
64 <div id="res3">This paragraph is the color that |
|
65 outerWindow.getComputedStyle says the display:none paragraph inside the |
|
66 iframe is.</div> |
|
67 |
|
68 <div id="res4">This paragraph is the color that |
|
69 iframeWindow.getComputedStyle says the display:none paragraph outside |
|
70 the iframe is.</div> |
|
71 |
|
72 <div id="res5">This paragraph is the color that |
|
73 outerWindow.getComputedStyle says the detached paragraph inside the |
|
74 iframe is.</div> |
|
75 |
|
76 <div id="res6">This paragraph is the color that |
|
77 iframeWindow.getComputedStyle says the detached paragraph outside |
|
78 the iframe is.</div> |