(display)
| 4284 | var measureText |
| 4285 | // Compute the default text height. |
| 4286 | function textHeight(display) { |
| 4287 | if (display.cachedTextHeight != null) { |
| 4288 | return display.cachedTextHeight |
| 4289 | } |
| 4290 | if (measureText == null) { |
| 4291 | measureText = elt("pre") |
| 4292 | // Measure a bunch of lines, for browsers that compute |
| 4293 | // fractional heights. |
| 4294 | for (var i = 0; i < 49; ++i) { |
| 4295 | measureText.appendChild(document.createTextNode("x")) |
| 4296 | measureText.appendChild(elt("br")) |
| 4297 | } |
| 4298 | measureText.appendChild(document.createTextNode("x")) |
| 4299 | } |
| 4300 | removeChildrenAndAdd(display.measure, measureText) |
| 4301 | var height = measureText.offsetHeight / 50 |
| 4302 | if (height > 3) { |
| 4303 | display.cachedTextHeight = height |
| 4304 | } |
| 4305 | removeChildren(display.measure) |
| 4306 | return height || 1 |
| 4307 | } |
| 4308 | |
| 4309 | // Compute the default character width. |
| 4310 | function charWidth(display) { |
no test coverage detected