Changeset 7329
- Timestamp:
- 06/07/08 11:17:10 (4 months ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Util.js (modified) (2 diffs)
- trunk/openlayers/tests/Util.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Util.js
r7311 r7329 1366 1366 OpenLayers.Util.getRenderedDimensions = function(contentHTML, size) { 1367 1367 1368 var w = h = null;1368 var w, h; 1369 1369 1370 1370 // create temp container div with restricted size … … 1377 1377 if (size) { 1378 1378 if (size.w) { 1379 w = container.style.width = size.w; 1379 w = size.w; 1380 container.style.width = w + "px"; 1380 1381 } else if (size.h) { 1381 h = container.style.height = size.h; 1382 h = size.h 1383 container.style.height = h + "px"; 1382 1384 } 1383 1385 } trunk/openlayers/tests/Util.html
r7311 r7329 783 783 784 784 } 785 786 function test_getRenderedDimensions(t) { 787 t.plan(2); 788 var content = (new Array(100)).join("foo "); 789 790 // test with fixed width 791 var fw = OpenLayers.Util.getRenderedDimensions(content, {w: 20}); 792 t.eq(fw.w, 20, "got the fixed width"); 793 794 // test with fixed height 795 var fh = OpenLayers.Util.getRenderedDimensions(content, {h: 15}); 796 t.eq(fh.h, 15, "got the fixed height"); 797 798 } 785 799 786 800 </script>
