OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <script src="../../../resources/js-test.js"></script> | |
3 <div id="parent" style="width: 200px; height: 200px;"> | |
4 <iframe id="iframe" seamless src="resources/square.html"></iframe> | |
5 </div> | |
6 <script> | |
7 debug("Test basic seamless auto-sizing-to-content functionality.") | |
8 window.onload = function () { | |
9 window.iframe = document.getElementById("iframe"); | |
10 shouldBeTrue("iframe.seamless"); | |
11 | |
12 // Seamless iframes are blocks, filling their parent width | |
13 // and setting their height to that of their children. | |
14 shouldBeEqualToString("window.getComputedStyle(iframe).display", "block"); | |
15 | |
16 // Spec: In visual media, in a CSS-supporting user agent: the user agent | |
17 // should set the intrinsic width of the iframe to the width that the elemen
t | |
18 // would have if it was a non-replaced block-level element with 'width: auto
'. | |
19 shouldBeEqualToString("window.getComputedStyle(iframe).width", "200px"); | |
20 | |
21 // Spec: In visual media, in a CSS-supporting user agent: the user agent | |
22 // should set the intrinsic height of the iframe to the height of the boundi
ng | |
23 // box around the content rendered in the iframe at its current width... | |
24 shouldBeEqualToString("window.getComputedStyle(iframe).height", "100px"); | |
25 | |
26 // Make sure dynamic updates work too. | |
27 iframe.contentDocument.documentElement.style.height = "200px"; | |
28 shouldBeEqualToString("window.getComputedStyle(iframe).height", "200px"); | |
29 | |
30 window.parentDiv = document.getElementById("parent"); | |
31 window.parentDiv.style.width = "100px"; | |
32 shouldBeEqualToString("window.getComputedStyle(iframe).width", "100px"); | |
33 } | |
34 </script> | |
OLD | NEW |