Skip to content

Commit 6aba7a2

Browse files
committed
Fix handling of colored backgrounds on math elements in IE, and on mspace/mpadded elements in IE < 8.
1 parent 993715c commit 6aba7a2

File tree

1 file changed

+21
-14
lines changed
  • unpacked/jax/output/HTML-CSS

1 file changed

+21
-14
lines changed

unpacked/jax/output/HTML-CSS/jax.js

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,8 @@
879879
delete jax.HTMLCSS;
880880
},
881881

882-
getHD: function (span) {
883-
if (span.bbox && this.config.noReflows) {return {h:span.bbox.h, d:span.bbox.d}}
882+
getHD: function (span,force) {
883+
if (span.bbox && this.config.noReflows && !force) {return {h:span.bbox.h, d:span.bbox.d}}
884884
var position = span.style.position;
885885
span.style.position = "absolute";
886886
this.HDimg.style.height = "0px";
@@ -1096,7 +1096,7 @@
10961096
createSpace: function (span,h,d,w,color,isSpace) {
10971097
if (h < -d) {d = -h} // make sure h is above d
10981098
var H = this.Em(h+d), D = this.Em(-d);
1099-
if (this.msieInlineBlockAlignBug) {D = this.Em(HTMLCSS.getHD(span.parentNode).d-d)}
1099+
if (this.msieInlineBlockAlignBug) {D = this.Em(HTMLCSS.getHD(span.parentNode,true).d-d)}
11001100
if (span.isBox || isSpace) {
11011101
var scale = (span.scale == null ? 1 : span.scale);
11021102
span.bbox = {exactW: true, h: h*scale, d: d*scale, w: w*scale, rw: w*scale, lw: 0};
@@ -2860,10 +2860,6 @@
28602860
// problem in strict HTML mode
28612861
stack.style.fontSize = nobr.parentNode.style.fontSize; nobr.parentNode.style.fontSize = "";
28622862
if (this.data[0] != null) {
2863-
if (HTMLCSS.msieColorBug) {
2864-
if (this.background) {this.data[0].background = this.background; delete this.background}
2865-
if (this.mathbackground) {this.data[0].mathbackground = this.mathbackground; delete this.mathbackground}
2866-
}
28672863
MML.mbase.prototype.displayAlign = HUB.config.displayAlign;
28682864
MML.mbase.prototype.displayIndent = HUB.config.displayIndent;
28692865
if (String(HUB.config.displayIndent).match(/^0($|[a-z%])/i))
@@ -2942,12 +2938,23 @@
29422938
//
29432939
// Move the background color, of any
29442940
//
2945-
if (color) {
2946-
color.style.marginLeft = HTMLCSS.Em(parseFloat(color.style.marginLeft)+shift);
2947-
color.style.marginRight =
2948-
HTMLCSS.Em(parseFloat(color.style.marginRight)-shift
2949-
+ (values.indentalign === "right" ? Math.min(0,span.bbox.w+shift) - span.bbox.w : 0));
2950-
}
2941+
if (color) {
2942+
var L = parseFloat(color.style.marginLeft||"0")+shift,
2943+
R = parseFloat(color.style.marginRight||"0")-shift;
2944+
color.style.marginLeft = HTMLCSS.Em(L);
2945+
color.style.marginRight =
2946+
HTMLCSS.Em(R + (values.indentalign === "right" ?
2947+
Math.min(0,span.bbox.w+shift) - span.bbox.w : 0));
2948+
if (HTMLCSS.msieColorBug && values.indentalign === "right") {
2949+
if (parseFloat(color.style.marginLeft) > 0) {
2950+
var padding = MathJax.HTML.addElement(color.parentNode,"span");
2951+
padding.style.marginLeft = HTMLCSS.Em(R+Math.min(0,span.bbox.w+shift));
2952+
color.nextSibling.style.marginRight = "0em";
2953+
}
2954+
color.nextSibling.style.marginLeft = "0em";
2955+
color.style.marginRight = color.style.marginLeft = "0em";
2956+
}
2957+
}
29512958
}
29522959
}
29532960
}
@@ -3020,7 +3027,7 @@
30203027
HTMLCSS.Augment({
30213028
PaddingWidthBug: true,
30223029
msieAccentBug: true,
3023-
msieColorBug: true,
3030+
msieColorBug: (mode < 8), // negative margin-right doesn't work to position color
30243031
msieColorPositionBug: true, // needs position:relative to put color behind text
30253032
msieRelativeWidthBug: quirks,
30263033
msieDisappearingBug: (mode >= 8), // inline math disappears

0 commit comments

Comments
 (0)