diff --git a/unpacked/jax/element/mml/jax.js b/unpacked/jax/element/mml/jax.js index 33041e3b4..980d2baf8 100644 --- 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 index 7924bf508..4e04e58d5 100644 --- 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; }