OpenLayers OpenLayers

root/trunk/openlayers/tests/manual/rendered-dimensions.html

Revision 7684, 0.7 kB (checked in by crschmidt, 5 months ago)

Improve getRenderedDimensions to take into account a CSS class. Refactor some
popup code to take advantage of this, to provide a better hint to the
getRenderedDimensions call as to what is going on. Patch from sbenthall, r=me,
includes a manual acceptance test (only because the testing framework makes
these kinds of things hard). Manually confirmed to work with the sundials.html
example, tested with that and manual test in IE6, IE7, FF2-Win FF3-Mac FF2-Mac
Safari-Mac Opera-Win, and in all browsers it worked. (Hooray!) Nice one,
sbenthall. (Closes #1500)

Line 
1 <html>
2 <head>
3 <style type="text/css">
4  .testDims p{
5     padding: 20px;
6 }    
7 </style>
8 <script src="../../lib/OpenLayers.js"></script>
9 <script>
10 function run() {
11     var out = document.getElementById("out");   
12     var size = OpenLayers.Util.getRenderedDimensions("<p>Content</p>");
13     var bigger = OpenLayers.Util.getRenderedDimensions("<p>Content</p>", null, {displayClass: 'testDims'});
14     if ((size.w + 40) == bigger.w && (size.h + 40) == bigger.h) {
15         out.innerHTML = "Pass:  " + size + ", " + bigger;
16     } else {
17         out.innerHTML = "Fail:  " + size + ", " + bigger;
18     }
19 } 
20 </script>
21 </head>
22 <body onload="run()">
23 <div id="out"></div>
24 </body>
25 </html>
Note: See TracBrowser for help on using the browser.