Merge pull request #1530 from dpvc/issue1478
Fix problem with Safari inserting line breaks before in-line math. #1478
This commit is contained in:
commit
4f87ff1b87
|
@ -180,7 +180,8 @@
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
width:"1px", height:"60ex"
|
width:"1px", height:"60ex"
|
||||||
},
|
},
|
||||||
".mjx-line-box-test": {
|
".mjx-line-box-test": {display: "table!important"},
|
||||||
|
".mjx-line-box-test span": {
|
||||||
display: "table-cell!important",
|
display: "table-cell!important",
|
||||||
width: "10000em!important",
|
width: "10000em!important",
|
||||||
"min-width":0, "max-width":"none",
|
"min-width":0, "max-width":"none",
|
||||||
|
@ -251,7 +252,7 @@
|
||||||
//
|
//
|
||||||
// Used in preTranslate to get linebreak width
|
// Used in preTranslate to get linebreak width
|
||||||
//
|
//
|
||||||
this.linebreakSpan = HTML.Element("span",{className:"mjx-line-box-test"});
|
this.linebreakSpan = HTML.Element("span",{className:"mjx-line-box-test"},[["span"]]);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set up styles and preload web fonts
|
// Set up styles and preload web fonts
|
||||||
|
@ -284,7 +285,7 @@
|
||||||
document.body.appendChild(this.linebreakSpan);
|
document.body.appendChild(this.linebreakSpan);
|
||||||
this.defaultEm = this.getFontSize(this.TestSpan);
|
this.defaultEm = this.getFontSize(this.TestSpan);
|
||||||
this.defaultEx = this.TestSpan.firstChild.offsetHeight/60;
|
this.defaultEx = this.TestSpan.firstChild.offsetHeight/60;
|
||||||
this.defaultWidth = this.linebreakSpan.offsetWidth;
|
this.defaultWidth = this.linebreakSpan.firstChild.offsetWidth;
|
||||||
document.body.removeChild(this.linebreakSpan);
|
document.body.removeChild(this.linebreakSpan);
|
||||||
document.body.removeChild(this.TestSpan);
|
document.body.removeChild(this.TestSpan);
|
||||||
},
|
},
|
||||||
|
@ -453,7 +454,7 @@
|
||||||
jax = script.MathJax.elementJax; if (!jax) continue;
|
jax = script.MathJax.elementJax; if (!jax) continue;
|
||||||
em = CHTML.getFontSize(test);
|
em = CHTML.getFontSize(test);
|
||||||
ex = test.firstChild.offsetHeight/60;
|
ex = test.firstChild.offsetHeight/60;
|
||||||
cwidth = Math.max(0,test.previousSibling.offsetWidth-2);
|
cwidth = Math.max(0,test.previousSibling.firstChild.offsetWidth-2);
|
||||||
if (ex === 0 || ex === "NaN") {
|
if (ex === 0 || ex === "NaN") {
|
||||||
ex = this.defaultEx;
|
ex = this.defaultEx;
|
||||||
cwidth = this.defaultWidth;
|
cwidth = this.defaultWidth;
|
||||||
|
|
|
@ -339,6 +339,9 @@
|
||||||
"min-height": 0, "max-height":"none"
|
"min-height": 0, "max-height":"none"
|
||||||
},
|
},
|
||||||
".MathJax_LineBox": {
|
".MathJax_LineBox": {
|
||||||
|
display: (oldIE ? "block" : "table") + "!important"
|
||||||
|
},
|
||||||
|
".MathJax_LineBox span": {
|
||||||
display: (oldIE ? "block" : "table-cell") + "!important",
|
display: (oldIE ? "block" : "table-cell") + "!important",
|
||||||
width: (oldIE ? "100%" : "10000em") + "!important",
|
width: (oldIE ? "100%" : "10000em") + "!important",
|
||||||
"min-width":0, "max-width":"none",
|
"min-width":0, "max-width":"none",
|
||||||
|
@ -495,7 +498,7 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
// Used in preTranslate to get linebreak width
|
// Used in preTranslate to get linebreak width
|
||||||
this.linebreakSpan = MathJax.HTML.Element("span",{className:"MathJax_LineBox"});
|
this.linebreakSpan = MathJax.HTML.Element("span",{className:"MathJax_LineBox"},[["span"]]);
|
||||||
|
|
||||||
// Set up styles and preload web fonts
|
// Set up styles and preload web fonts
|
||||||
return AJAX.Styles(this.config.styles,["InitializeHTML",this]);
|
return AJAX.Styles(this.config.styles,["InitializeHTML",this]);
|
||||||
|
@ -551,7 +554,7 @@
|
||||||
document.body.appendChild(this.linebreakSpan);
|
document.body.appendChild(this.linebreakSpan);
|
||||||
this.defaultEx = this.EmExSpan.firstChild.offsetHeight/60;
|
this.defaultEx = this.EmExSpan.firstChild.offsetHeight/60;
|
||||||
this.defaultEm = this.EmExSpan.lastChild.firstChild.offsetHeight/60;
|
this.defaultEm = this.EmExSpan.lastChild.firstChild.offsetHeight/60;
|
||||||
this.defaultWidth = this.linebreakSpan.offsetWidth;
|
this.defaultWidth = this.linebreakSpan.firstChild.offsetWidth;
|
||||||
document.body.removeChild(this.linebreakSpan);
|
document.body.removeChild(this.linebreakSpan);
|
||||||
document.body.removeChild(this.EmExSpan);
|
document.body.removeChild(this.EmExSpan);
|
||||||
},
|
},
|
||||||
|
@ -621,7 +624,7 @@
|
||||||
jax = script.MathJax.elementJax; if (!jax) continue;
|
jax = script.MathJax.elementJax; if (!jax) continue;
|
||||||
ex = test.firstChild.offsetHeight/60;
|
ex = test.firstChild.offsetHeight/60;
|
||||||
em = test.lastChild.firstChild.offsetHeight/60;
|
em = test.lastChild.firstChild.offsetHeight/60;
|
||||||
cwidth = Math.max(0,div.previousSibling.offsetWidth - 2);
|
cwidth = Math.max(0,div.previousSibling.firstChild.offsetWidth - 2);
|
||||||
if (relwidth) {maxwidth = cwidth}
|
if (relwidth) {maxwidth = cwidth}
|
||||||
if (ex === 0 || ex === "NaN") {
|
if (ex === 0 || ex === "NaN") {
|
||||||
// can't read width, so move to hidden div for processing
|
// can't read width, so move to hidden div for processing
|
||||||
|
|
|
@ -100,7 +100,8 @@
|
||||||
"min-height": 0, "max-height":"none",
|
"min-height": 0, "max-height":"none",
|
||||||
padding:0, border: 0, margin: 0
|
padding:0, border: 0, margin: 0
|
||||||
},
|
},
|
||||||
".MathJax_SVG_LineBox": {
|
".MathJax_SVG_LineBox": {display: "table!important"},
|
||||||
|
".MathJax_SVG_LineBox span": {
|
||||||
display: "table-cell!important",
|
display: "table-cell!important",
|
||||||
width: "10000em!important",
|
width: "10000em!important",
|
||||||
"min-width":0, "max-width":"none",
|
"min-width":0, "max-width":"none",
|
||||||
|
@ -179,7 +180,7 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
// Used in preTranslate to get linebreak width
|
// Used in preTranslate to get linebreak width
|
||||||
this.linebreakSpan = HTML.Element("span",{className:"MathJax_SVG_LineBox"});
|
this.linebreakSpan = HTML.Element("span",{className:"MathJax_SVG_LineBox"},[["span"]]);
|
||||||
|
|
||||||
// Set up styles
|
// Set up styles
|
||||||
return AJAX.Styles(this.config.styles,["InitializeSVG",this]);
|
return AJAX.Styles(this.config.styles,["InitializeSVG",this]);
|
||||||
|
@ -195,7 +196,7 @@
|
||||||
document.body.appendChild(this.ExSpan);
|
document.body.appendChild(this.ExSpan);
|
||||||
document.body.appendChild(this.linebreakSpan);
|
document.body.appendChild(this.linebreakSpan);
|
||||||
this.defaultEx = this.ExSpan.firstChild.offsetHeight/60;
|
this.defaultEx = this.ExSpan.firstChild.offsetHeight/60;
|
||||||
this.defaultWidth = this.linebreakSpan.offsetWidth;
|
this.defaultWidth = this.linebreakSpan.firstChild.offsetWidth;
|
||||||
document.body.removeChild(this.linebreakSpan);
|
document.body.removeChild(this.linebreakSpan);
|
||||||
document.body.removeChild(this.ExSpan);
|
document.body.removeChild(this.ExSpan);
|
||||||
},
|
},
|
||||||
|
@ -261,7 +262,7 @@
|
||||||
test = script.previousSibling; div = test.previousSibling;
|
test = script.previousSibling; div = test.previousSibling;
|
||||||
jax = script.MathJax.elementJax; if (!jax) continue;
|
jax = script.MathJax.elementJax; if (!jax) continue;
|
||||||
ex = test.firstChild.offsetHeight/60;
|
ex = test.firstChild.offsetHeight/60;
|
||||||
cwidth = Math.max(0,(div.previousSibling.offsetWidth-2) / this.config.scale * 100);
|
cwidth = Math.max(0,(div.previousSibling.firstChild.offsetWidth-2) / this.config.scale * 100);
|
||||||
if (ex === 0 || ex === "NaN") {
|
if (ex === 0 || ex === "NaN") {
|
||||||
// can't read width, so move to hidden div for processing
|
// can't read width, so move to hidden div for processing
|
||||||
// (this will cause a reflow for each math element that is hidden)
|
// (this will cause a reflow for each math element that is hidden)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user