www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit d2fd86b75a0d105700809f192754088485dfd11c
parent 75baf0e3ced641f01e2a28d11626cbe19fde96ac
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Fri, 20 Mar 2015 13:54:54 -0400

If the container's width is 0, also check for max-width before looking at parent element (finds container width better).

Diffstat:
Munpacked/jax/output/CommonHTML/jax.js | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/unpacked/jax/output/CommonHTML/jax.js b/unpacked/jax/output/CommonHTML/jax.js @@ -275,7 +275,7 @@ // // Get linebreaking information // - var maxwidth = 100000, relwidth = false, cwidth, + var maxwidth = 100000, relwidth = false, cwidth = 0, linebreak = this.config.linebreaks.automatic, width = this.config.linebreaks.width; if (linebreak) { @@ -338,8 +338,12 @@ ex = test.firstChild.offsetHeight/60; if (ex === 0 || ex === "NaN") ex = this.defaultEx node = test; - while (node && node.offsetWidth === 0) node = node.parentNode; - cwidth = (node ? node.offsetWidth : this.defaultWidth); + while (node) { + cwidth = node.offsetWidth; if (cwidth) break; + var style = window.getComputedStyle(node); + if (style.maxWidth !== "none") {cwidth = parseFloat(style.maxWidth); break} + node = node.parentNode; + } scale = (this.config.matchFontHeight ? ex/this.TEX.x_height/em : 1); scale = Math.floor(Math.max(this.config.minScaleAdjust/100,scale)*this.config.scale);