layout/reftests/cssom/computed-style-cross-window.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.

     1 <!DOCTYPE HTML>
     2 <html class="reftest-wait">
     3 <title>getComputedStyle across windows</title>
     4 <style>
     5 p { color: blue }
     7 div { margin: 1em 0 }
     8 </style>
    10 <script>
    12 var gRunCount = 2;
    14 function run() {
    15   if (--gRunCount != 0)
    16     return;
    18   var i = document.getElementById("i");
    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");
    27   document.getElementById("res1").style.color =
    28     window.getComputedStyle(pin, "").color;
    30   document.getElementById("res2").style.color =
    31     i.contentWindow.getComputedStyle(pout, "").color;
    33   document.getElementById("res3").style.color =
    34     window.getComputedStyle(pinnone, "").color;
    36   document.getElementById("res4").style.color =
    37     i.contentWindow.getComputedStyle(poutnone, "").color;
    39   document.getElementById("res5").style.color =
    40     window.getComputedStyle(pindet, "").color;
    42   document.getElementById("res6").style.color =
    43     i.contentWindow.getComputedStyle(poutdet, "").color;
    45   document.documentElement.removeAttribute("class");
    46 }
    48 </script>
    49 <body onload="run()">
    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>
    54 <iframe id="i" src="computed-style-cross-window-inner.html" onload="run()"></iframe>
    56 <div id="res1">This paragraph is the color that
    57 outerWindow.getComputedStyle says the paragraph inside the iframe
    58 is.</div>
    60 <div id="res2">This paragraph is the color that
    61 iframeWindow.getComputedStyle says the paragraph outside the iframe
    62 is.</div>
    64 <div id="res3">This paragraph is the color that
    65 outerWindow.getComputedStyle says the display:none paragraph inside the
    66 iframe is.</div>
    68 <div id="res4">This paragraph is the color that
    69 iframeWindow.getComputedStyle says the display:none paragraph outside
    70 the iframe is.</div>
    72 <div id="res5">This paragraph is the color that
    73 outerWindow.getComputedStyle says the detached paragraph inside the
    74 iframe is.</div>
    76 <div id="res6">This paragraph is the color that
    77 iframeWindow.getComputedStyle says the detached paragraph outside
    78 the iframe is.</div>

mercurial