layout/reftests/cssom/computed-style-cross-window-ref.html

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

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

mercurial