(display)
| 2839 | var measureText; |
| 2840 | // Compute the default text height. |
| 2841 | function textHeight(display) { |
| 2842 | if (display.cachedTextHeight != null) return display.cachedTextHeight; |
| 2843 | if (measureText == null) { |
| 2844 | measureText = elt("pre"); |
| 2845 | // Measure a bunch of lines, for browsers that compute |
| 2846 | // fractional heights. |
| 2847 | for (var i = 0; i < 49; ++i) { |
| 2848 | measureText.appendChild(document.createTextNode("x")); |
| 2849 | measureText.appendChild(elt("br")); |
| 2850 | } |
| 2851 | measureText.appendChild(document.createTextNode("x")); |
| 2852 | } |
| 2853 | removeChildrenAndAdd(display.measure, measureText); |
| 2854 | var height = measureText.offsetHeight / 50; |
| 2855 | if (height > 3) display.cachedTextHeight = height; |
| 2856 | removeChildren(display.measure); |
| 2857 | return height || 1; |
| 2858 | } |
| 2859 | |
| 2860 | // Compute the default character width. |
| 2861 | function charWidth(display) { |
no test coverage detected