diff --git a/unpacked/jax/output/HTML-CSS/autoload/maction.js b/unpacked/jax/output/HTML-CSS/autoload/maction.js index 02bb97bc5..05c196eaa 100644 --- a/unpacked/jax/output/HTML-CSS/autoload/maction.js +++ b/unpacked/jax/output/HTML-CSS/autoload/maction.js @@ -1,3 +1,5 @@ +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * MathJax/jax/output/HTML-CSS/autoload/maction.js @@ -41,15 +43,19 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { HTMLtooltip: HTMLCSS.addElement(document.body,"div",{id:"MathJax_Tooltip"}), toHTML: function (span,HW,D) { - span = this.HTMLhandleSize(this.HTMLcreateSpan(span)); span.bbox = null; var selected = this.selected(); - if (selected) { - var box = selected.toHTML(span); - if (D != null) {HTMLCSS.Remeasured(selected.HTMLstretchV(span,HW,D),span)} - else if (HW != null) {HTMLCSS.Remeasured(selected.HTMLstretchH(span,HW),span)} - else {HTMLCSS.Measured(box,span)} - this.HTMLhandleHitBox(span); + if (selected.type == "null") { + span = this.HTMLcreateSpan(span); + span.bbox = this.HTMLzeroBBox(); + return span; } + span = this.HTMLhandleSize(this.HTMLcreateSpan(span)); span.bbox = null; + var box = selected.toHTML(span); + if (D != null) {HTMLCSS.Remeasured(selected.HTMLstretchV(span,HW,D),span)} + else if (HW != null) { + HTMLCSS.Remeasured(selected.HTMLstretchH(span,HW),span) + } else {HTMLCSS.Measured(box,span)} + this.HTMLhandleHitBox(span); this.HTMLhandleSpace(span); this.HTMLhandleColor(span); return span; diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js index 1b7c356bf..52bfa7737 100644 --- a/unpacked/jax/output/HTML-CSS/jax.js +++ b/unpacked/jax/output/HTML-CSS/jax.js @@ -1641,7 +1641,7 @@ var SPAN = this.HTMLspanElement(); if (SPAN && (SPAN.parentNode === span || (SPAN.parentNode||{}).parentNode === span)) { while (SPAN.firstChild) {SPAN.removeChild(SPAN.firstChild)} - SPAN.bbox = {w:0, h:0, d:0, lw:0, rw:0}; + SPAN.bbox = this.HTMLzeroBBox(); SPAN.scale = 1; SPAN.isMultChar = SPAN.HH = null; SPAN.style.cssText = ""; return SPAN; @@ -1653,7 +1653,7 @@ if (this["class"]) {span.className += " "+this["class"]} if (!this.spanID) {this.spanID = HTMLCSS.GetID()} span.id = (this.id || "MathJax-Span-"+this.spanID) + HTMLCSS.idPostfix; - span.bbox = {w:0, h:0, d:0, lw:0, rw:0}; this.styles = {}; + span.bbox = this.HTMLzeroBBox(); this.styles = {}; if (this.style) { span.style.cssText = this.style; if (span.style.fontSize) {this.mathsize = span.style.fontSize; span.style.fontSize = ""} @@ -1919,7 +1919,7 @@ var variant = this.HTMLgetVariant(); for (var i = 0, m = this.data.length; i < m; i++) {if (this.data[i]) {this.data[i].toHTML(span,variant)}} - if (!span.bbox) {span.bbox = {w:0, h:0, d:0, rw:0, lw:0}} + if (!span.bbox) {span.bbox = this.HTMLzeroBBox()} var text = this.data.join(""), bbox = span.bbox; if (bbox.skew && text.length !== 1) {delete bbox.skew} if (bbox.rw > bbox.w && text.length === 1 && !variant.noIC) { @@ -1939,7 +1939,7 @@ var variant = this.HTMLgetVariant(); for (var i = 0, m = this.data.length; i < m; i++) {if (this.data[i]) {this.data[i].toHTML(span,variant)}} - if (!span.bbox) {span.bbox = {w:0, h:0, d:0, rw:0, lw:0}} + if (!span.bbox) {span.bbox = this.HTMLzeroBBox()} if (this.data.join("").length !== 1) {delete span.bbox.skew} this.HTMLhandleSpace(span); this.HTMLhandleColor(span); @@ -1981,7 +1981,7 @@ // for (var i = 0, m = this.data.length; i < m; i++) {if (this.data[i]) {this.data[i].toHTML(span,variant,this.HTMLremap,mapchars)}} - if (!span.bbox) {span.bbox = {w:0, h:0, d:0, rw:0, lw:0}} + if (!span.bbox) {span.bbox = this.HTMLzeroBBox()} if (text.length !== 1) {delete span.bbox.skew} // // Handle combining characters by adding a non-breaking space and removing that width @@ -2108,7 +2108,7 @@ {variant = {bold:variant.bold, italic:variant.italic, fontInherit: true}} for (var i = 0, m = this.data.length; i < m; i++) {if (this.data[i]) {this.data[i].toHTML(span,variant)}} - if (!span.bbox) {span.bbox = {w:0, h:0, d:0, rw:0, lw:0}} + if (!span.bbox) {span.bbox = this.HTMLzeroBBox()} if (this.data.join("").length !== 1) {delete span.bbox.skew} this.HTMLhandleSpace(span); this.HTMLhandleColor(span); diff --git a/unpacked/jax/output/SVG/autoload/maction.js b/unpacked/jax/output/SVG/autoload/maction.js index 356ee4b4c..f587f76b6 100644 --- a/unpacked/jax/output/SVG/autoload/maction.js +++ b/unpacked/jax/output/SVG/autoload/maction.js @@ -1,3 +1,5 @@ +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * MathJax/jax/output/SVG/autoload/maction.js @@ -44,10 +46,9 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { this.SVGgetStyles(); var svg = this.SVG(); var selected = this.selected(); - if (selected) { - svg.Add(this.SVGdataStretched(this.Get("selection")-1,HW,D)); - this.SVGhandleHitBox(svg); - } + if (selected.type == "null") {this.SVGsaveData(svg);return svg;} + svg.Add(this.SVGdataStretched(this.Get("selection")-1,HW,D)); + this.SVGhandleHitBox(svg); this.SVGhandleSpace(svg); this.SVGhandleColor(svg); this.SVGsaveData(svg);