www

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

commit 6e1301e6817af1ff1ce98a608eec76376f7e1f70
parent 966444bc3105366eec2d8ebbc98d65426b9a8dff
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Mon, 24 Aug 2015 08:23:20 -0400

Update CHTML to get the proper node for handling horizontal stretchy characters.

Diffstat:
Munpacked/jax/element/mml/jax.js | 4+++-
Munpacked/jax/output/CommonHTML/jax.js | 26++++++++++++++++++--------
2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/unpacked/jax/element/mml/jax.js b/unpacked/jax/element/mml/jax.js @@ -405,7 +405,9 @@ MathJax.ElementJax.mml.Augment({ if (child == null) return; for (var i = 0, m = this.data.length; i < m; i++) if (child === this.data[i]) return i; }, - CoreIndex: function () {return this.childIndex(this.Core())}, + CoreIndex: function () { + return (this.inferRow ? this.data[0]||this : this).childIndex(this.Core()); + }, hasNewline: function () { if (this.isEmbellished()) {return this.CoreMO().hasNewline()} if (this.isToken || this.linebreakContainer) {return false} diff --git a/unpacked/jax/output/CommonHTML/jax.js b/unpacked/jax/output/CommonHTML/jax.js @@ -1333,6 +1333,16 @@ } else if (options.forceChild) {cnode = HTML.addElement(node,"mjx-box")} return cnode; }, + + CHTMLchildNode: function (node,i) { + node = node.childNodes[i]; + if (node.nodeName.toLowerCase() === "a") node = node.firstChild; + return node; + }, + CHTMLcoreNode: function (node) { + return this.CHTMLchildNode(node,this.CoreIndex()); + }, + CHTMLstretchChildV: function (i,H,D) { var data = this.data[i]; if (data) { @@ -1355,7 +1365,7 @@ var bbox = this.CHTML, dbox = data.CHTML; if (dbox.stretch || (dbox.stretch == null && data.CHTMLcanStretch("Horizontal",W))) { var w = dbox.w; - dbox = data.CHTMLstretchH(node,W); + dbox = data.CHTMLstretchH(this.CHTMLchildNode(node,i),W); bbox.w += dbox.w - w; if (bbox.w > bbox.r) bbox.r = bbox.w; if (dbox.h > bbox.h) bbox.h = dbox.h; @@ -1380,9 +1390,12 @@ return this.CHTML; }, CHTMLstretchH: function (node,w) { - this.CHTML.updateFrom(this.Core().CHTMLstretchH(node,w)); + this.CHTML.updateFrom(this.CHTMLstretchCoreH(node,w)); return this.CHTML; }, + CHTMLstretchCoreH: function (node,w) { + return this.Core().CHTMLstretchH(this.CHTMLcoreNode(node),w); + }, CHTMLcreateNode: function (node) { if (!this.CHTML) this.CHTML = {}; @@ -1599,7 +1612,7 @@ return this.CHTML; }, CHTMLstretchH: function (node,w) { - this.Core().CHTMLstretchH(node,w); + this.CHTMLstretchCoreH(node,w); this.toCommonHTML(node,true); return this.CHTML; } @@ -2477,10 +2490,7 @@ return this.CHTML; }, CHTMLstretchH: function (node,w) { - var i = this.CoreIndex() - node = node.childNodes[i]; - if (node.nodeName.toLowerCase() === "a") node = node.firstChild; - this.CHTMLstretchChildH(i,w,node); + this.CHTMLstretchChildH(this.CoreIndex(),w,node); return this.CHTML; } }); @@ -2516,7 +2526,7 @@ return this.CHTML; }, CHTMLstretchH: function (node,w) { - this.CHTML.updateFrom(this.Core().CHTMLstretchH(node.firstChild,w)); + this.CHTML.updateFrom(this.CHTMLstretchCoreH(node,w)); this.toCommonHTML(node,true); return this.CHTML; }