commit d0b024243bb6661835a9ee79137a6fb2dfadc517
parent 4fefa49080ac88ce679ce4f9b30d0fa65a079105
Author: Frédéric Wang <fred.wang@free.fr>
Date: Mon, 11 Feb 2013 14:29:09 +0100
Better construct empty frames when maction@selection is invalid
Diffstat:
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/unpacked/jax/output/HTML-CSS/autoload/maction.js b/unpacked/jax/output/HTML-CSS/autoload/maction.js
@@ -43,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.type !== "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);
+ if (selected.type == "null") {
+ span = this.HTMLcreateSpan(span);
+ span.bbox = {h:0, d:0, w:0, lw:0, rw:0};
+ 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/SVG/autoload/maction.js b/unpacked/jax/output/SVG/autoload/maction.js
@@ -46,10 +46,9 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
this.SVGgetStyles();
var svg = this.SVG();
var selected = this.selected();
- if (selected.type !== "null") {
- 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);