on master help sign in
Fix bug with text resizing in FF and IE. Both report clientWidth and clientHeight as an integer that has been rounded DOWN from the actual float value. This means they can be too small. Switched to using getComputedStyle.
commitd9d6ce51ca63e818caf78f5bd432f8631fd71595 authorevancz <info@elm-lang.org> dateWed 22 May 2013, 10:50 (13 years ago) parent1759e78
1 file changed+3−2
libraries/Native/Utils.js+3−2
libraries/Native/Utils.js+3−2
@@ -114,8 +114,9 @@ Elm.Native.Utils = function(elm) {
114114 t.style.cssFloat = "left";
115115
116116 elm.node.appendChild(t);
117− var w = t.clientWidth;
118− var h = t.clientHeight;
117+ var style = window.getComputedStyle(t, null);
118+ var w = Math.ceil(style.getPropertyValue("width").slice(0,-2) - 0);
119+ var h = Math.ceil(style.getPropertyValue("height").slice(0,-2) - 0);
119120 elm.node.removeChild(t);
120121 return Tuple2(w,h);
121122 }