(display)
| 2945 | var measureText; |
| 2946 | // Compute the default text height. |
| 2947 | function textHeight(display) { |
| 2948 | if (display.cachedTextHeight != null) return display.cachedTextHeight; |
| 2949 | if (measureText == null) { |
| 2950 | measureText = elt("pre"); |
| 2951 | // Measure a bunch of lines, for browsers that compute |
| 2952 | // fractional heights. |
| 2953 | for (var i = 0; i < 49; ++i) { |
| 2954 | measureText.appendChild(document.createTextNode("x")); |
| 2955 | measureText.appendChild(elt("br")); |
| 2956 | } |
| 2957 | measureText.appendChild(document.createTextNode("x")); |
| 2958 | } |
| 2959 | removeChildrenAndAdd(display.measure, measureText); |
| 2960 | var height = measureText.offsetHeight / 50; |
| 2961 | if (height > 3) display.cachedTextHeight = height; |
| 2962 | removeChildren(display.measure); |
| 2963 | return height || 1; |
| 2964 | } |
| 2965 | |
| 2966 | // Compute the default character width. |
| 2967 | function charWidth(display) { |
no test coverage detected