Ticket #1570: grd.patch
| File grd.patch, 1.6 kB (added by tschaub, 7 months ago) |
|---|
-
tests/Util.html
old new 770 770 t.ok(ret == g_TestVal3, "try returns first sucessfully executed function's return"); 771 771 772 772 } 773 774 function test_getRenderedDimensions(t) { 775 t.plan(2); 776 var content = (new Array(100)).join("foo "); 777 778 // test with fixed width 779 var fw = OpenLayers.Util.getRenderedDimensions(content, {w: 20}); 780 t.eq(fw.w, 20, "got the fixed width"); 781 782 // test with fixed height 783 var fh = OpenLayers.Util.getRenderedDimensions(content, {h: 15}); 784 t.eq(fh.h, 15, "got the fixed height"); 785 786 } 773 787 774 788 </script> 775 789 </head> -
lib/OpenLayers/Util.js
old new 1364 1364 */ 1365 1365 OpenLayers.Util.getRenderedDimensions = function(contentHTML, size) { 1366 1366 1367 var w = h = null;1367 var w, h; 1368 1368 1369 1369 // create temp container div with restricted size 1370 1370 var container = document.createElement("div"); … … 1375 1375 //fix a dimension, if specified. 1376 1376 if (size) { 1377 1377 if (size.w) { 1378 w = container.style.width = size.w; 1378 w = size.w; 1379 container.style.width = w + "px"; 1379 1380 } else if (size.h) { 1380 h = container.style.height = size.h; 1381 h = size.h 1382 container.style.height = h + "px"; 1381 1383 } 1382 1384 } 1383 1385
