@@ -67,7 +67,7 @@ if (!document.getElementById || !document.childNodes || !document.createElement)
67
67
68
68
window . jsMath = {
69
69
70
- version : "3.6d " , // change this if you edit the file, but don't edit this file
70
+ version : "3.6e " , // change this if you edit the file, but don't edit this file
71
71
72
72
document : document , // the document loading jsMath
73
73
window : window , // the window of the of loading document
@@ -306,7 +306,8 @@ window.jsMath = {
306
306
BBoxFor : function ( s ) {
307
307
this . hidden . innerHTML =
308
308
'<nobr><span class="typeset"><span class="scale">' + s + '</span></span></nobr>' ;
309
- var bbox = { w : this . hidden . offsetWidth , h : this . hidden . offsetHeight } ;
309
+ var math = ( jsMath . Browser . msieBBoxBug ? this . hidden . firstChild . firstChild : this . hidden ) ;
310
+ var bbox = { w : math . offsetWidth , h : this . hidden . offsetHeight } ;
310
311
this . hidden . innerHTML = '' ;
311
312
return bbox ;
312
313
} ,
@@ -325,24 +326,6 @@ window.jsMath = {
325
326
return cache [ this . em ] [ s ] ;
326
327
} ,
327
328
328
- /*
329
- * For browsers that don't handle sizes of italics properly (MSIE).
330
- * Check the cache first to see if we've already measured it.
331
- */
332
- EmBoxForItalics : function ( s ) {
333
- var cache = jsMath . Global . cache . R ;
334
- if ( ! cache [ this . em ] ) { cache [ this . em ] = { } }
335
- if ( ! cache [ this . em ] [ s ] ) {
336
- var bbox = this . BBoxFor ( s ) ;
337
- if ( s . match ( / < i > | c l a s s = \" ( i c m | i t a l i c | i g r e e k | i a c c e n t ) / i) ) {
338
- bbox . w = bbox . Mw = this . BBoxFor ( s + jsMath . Browser . italicString ) . w
339
- - jsMath . Browser . italicCorrection ;
340
- }
341
- cache [ this . em ] [ s ] = { w : bbox . w / this . em , h : bbox . h / this . em } ;
342
- }
343
- return cache [ this . em ] [ s ] ;
344
- } ,
345
-
346
329
/*
347
330
* Initialize jsMath. This determines the em size, and a variety
348
331
* of other parameters used throughout jsMath.
@@ -363,9 +346,7 @@ window.jsMath = {
363
346
if ( ! cache [ this . em ] ) {
364
347
cache [ this . em ] = { } ;
365
348
cache [ this . em ] . bb = this . BBoxFor ( 'x' ) ; var hh = cache [ this . em ] . bb . h ;
366
- cache [ this . em ] . d = this . BBoxFor ( 'x' + jsMath . HTML . Rule ( 1 , hh / jsMath . em ) ) . h - hh ;
367
- if ( jsMath . Browser . italicString )
368
- { cache [ this . em ] . ic = jsMath . BBoxFor ( jsMath . Browser . italicString ) . w }
349
+ cache [ this . em ] . d = this . BBoxFor ( 'x' + jsMath . HTML . Strut ( hh / this . em ) ) . h - hh ;
369
350
}
370
351
jsMath . Browser . italicCorrection = cache [ this . em ] . ic ;
371
352
var bb = cache [ this . em ] . bb ; var h = bb . h ; var d = cache [ this . em ] . d
@@ -1099,10 +1080,8 @@ jsMath.Setup = {
1099
1080
*/
1100
1081
TeXfont : function ( name ) {
1101
1082
var font = jsMath . TeX [ name ] ; if ( font == null ) return ;
1102
- var WH = jsMath . EmBoxFor ( '<span class="' + name + '">' + font [ 65 ] . c + '</span>' ) ;
1103
- font . hd = WH . h ;
1104
- font . d = jsMath . EmBoxFor ( '<span class="' + name + '">' + font [ 65 ] . c +
1105
- jsMath . HTML . Rule ( 1 , font . hd ) + '</span>' ) . h - font . hd ;
1083
+ font . hd = jsMath . EmBoxFor ( '<span class="' + name + '">' + font [ 65 ] . c + '</span>' ) . h ;
1084
+ font . d = jsMath . EmBoxFor ( '<span class="' + name + '">' + font [ 65 ] . c + jsMath . HTML . Strut ( font . hd ) + '</span>' ) . h - font . hd ;
1106
1085
font . h = font . hd - font . d ;
1107
1086
if ( name == 'cmmi10' ) { font . skewchar = 0177 }
1108
1087
else if ( name == 'cmsy10' ) { font . skewchar = 060 }
@@ -1298,7 +1277,7 @@ jsMath.Browser = {
1298
1277
* or varies with the height of the rest of the line (MSIE).
1299
1278
*/
1300
1279
TestSpanHeight : function ( ) {
1301
- jsMath . hidden . innerHTML = '<span><span style="' + this . block + ';height:2em;width:1px"></span></span>' ;
1280
+ jsMath . hidden . innerHTML = '<span><span style="' + this . block + ';height:2em;width:1px"></span>x </span>' ;
1302
1281
var span = jsMath . hidden . firstChild ;
1303
1282
var img = span . firstChild ;
1304
1283
this . spanHeightVaries = ( span . offsetHeight >= img . offsetHeight && span . offsetHeight > 0 ) ;
@@ -1328,11 +1307,12 @@ jsMath.Browser = {
1328
1307
'<span style="' + this . block + ';height:' + h + 'px;width:1px;vertical-align:-' + h + 'px"></span>' ) . h > 2 * h ;
1329
1308
this . widthAddsBorder = jsMath . BBoxFor ( '<span style="' + this . block +
1330
1309
';overflow:hidden;height:1px;width:10px;border-left:10px solid"></span>' ) . w > 10 ;
1331
- this . msieBorderBug =
1332
- jsMath . BBoxFor ( '<span style="' + this . block + ';height:' + h + 'px;width:1px"></span>x' ) . h !=
1333
- jsMath . BBoxFor ( '<span style="' + this . block + ';height:' + h + 'px;width:1px;border-left:1px solid"></span>x' ) . h ;
1334
- this . blankWidthBug = this . msieBorderBug ||
1335
- jsMath . BBoxFor ( '<span style="' + this . block + ';height:2em;width:0px"></span>' ) . h == 0 ;
1310
+ var h1 = jsMath . BBoxFor ( '<span style="' + this . block + ';height:' + h + 'px;width:1px"></span>x' ) . h ,
1311
+ h2 = jsMath . BBoxFor ( '<span style="' + this . block + ';height:' + h + 'px;width:1px;border-left:1px solid"></span>x' ) . h ,
1312
+ h3 = jsMath . BBoxFor ( '<span style="' + this . block + ';height:2em"></span>' ) . h ;
1313
+ this . msieBlockDepthBug = ( h1 == h ) ;
1314
+ this . msieRuleDepthBug = ( h2 == h ) ;
1315
+ this . blankWidthBug = ( h3 == 0 ) ;
1336
1316
} ,
1337
1317
1338
1318
/*
@@ -1409,12 +1389,14 @@ jsMath.Browser = {
1409
1389
// Handle bug-filled Internet Explorer
1410
1390
//
1411
1391
MSIE : function ( ) {
1412
- if ( this . spanHeightVaries && ! this . spanHeightTooBig ) {
1392
+ if ( jsMath . BBoxFor ( "<!--[if IE]>IE<![endif]-->" ) . w ) {
1413
1393
jsMath . browser = 'MSIE' ;
1414
1394
if ( jsMath . platform == 'pc' ) {
1415
1395
this . IE7 = ( window . XMLHttpRequest != null ) ;
1416
- this . IE8 = ( jsMath . BBoxFor ( "<!--[if gte IE 8]>hi<![endif]-->" ) . w > 0 ) ;
1396
+ this . IE8 = ( jsMath . BBoxFor ( "<!--[if gte IE 8]>IE8<![endif]-->" ) . w > 0 ) ;
1397
+ this . isReallyIE8 = ( jsMath . document . documentMode != null ) ;
1417
1398
this . quirks = ( jsMath . document . compatMode == "BackCompat" ) ;
1399
+ this . msieMode = ( jsMath . document . documentMode || ( this . quirks ? 5 : 7 ) ) ;
1418
1400
this . msieStandard6 = ! this . quirks && ! this . IE7 ;
1419
1401
this . allowAbsoluteDelim = 1 ; this . separateSkips = 1 ;
1420
1402
this . buttonCheck = 1 ; this . msieBlankBug = 1 ;
@@ -1424,10 +1406,11 @@ jsMath.Browser = {
1424
1406
this . msieAlphaBug = ! this . IE7 ; this . alphaPrintBug = ! this . IE7 ;
1425
1407
this . msieCenterBugFix = 'position:relative; ' ;
1426
1408
this . msieInlineBlockFix = ' display:inline-block;' ;
1427
- this . msie8HeightBug = ( this . IE8 && ! this . quirks ) ;
1428
- this . msieTeXfontBaselineBug = ! this . quirks ;
1429
- this . msieBorderBug = this . blankWidthBug = 1 ; // force these, since IE7 doesn't register it
1430
- this . msieSpaceFix = '<span style="margin-right:-1px"></span><span style="display:inline-block; width:1px"></span>' ;
1409
+ this . msie8HeightBug = this . msieBBoxBug = ( this . msieMode == 8 ) ;
1410
+ this . blankWidthBug = ( this . msieMode != 8 ) ;
1411
+ this . msieSpaceFix = ( this . isReallyIE8 ?
1412
+ '<span style="display:inline-block; margin-right:-1px; width:1px"></span>' :
1413
+ '<span style="margin-right:-1px; width:1px"></span>' ) ;
1431
1414
jsMath . Macro ( 'joinrel' , '\\mathrel{\\kern-5mu}' ) ,
1432
1415
jsMath . Parser . prototype . mathchardef . mapstocharOrig = jsMath . Parser . prototype . mathchardef . mapstochar ;
1433
1416
delete jsMath . Parser . prototype . mathchardef . mapstochar ;
@@ -1463,9 +1446,8 @@ jsMath.Browser = {
1463
1446
this . imgScale *= screen . logicalXDPI / screen . deviceXDPI ;
1464
1447
jsMath . Controls . cookie . alpha = 0 ;
1465
1448
}
1466
- // Handle bug with getting width of italic text
1467
- this . italicString = '<i>x</i>' ;
1468
- jsMath . EmBoxFor = jsMath . EmBoxForItalics ;
1449
+ // IE8 doesn't puts ALL boxes at the bottom rather than on the baseline
1450
+ if ( this . msieRuleDepthBug ) { jsMath . HTML . Strut = jsMath . HTML . msieStrut }
1469
1451
} else if ( jsMath . platform == 'mac' ) {
1470
1452
this . msieAbsoluteBug = 1 ; this . msieButtonBug = 1 ;
1471
1453
this . msieDivWidthBug = 1 ; this . msieBlankBug = 1 ;
@@ -2795,7 +2777,7 @@ jsMath.HTML = {
2795
2777
style += 'height:' + H + ';' ;
2796
2778
}
2797
2779
if ( jsMath . Browser . mozInlineBlockBug ) { d = - h }
2798
- if ( jsMath . Browser . msieBorderBug && ! isRule ) { d -= jsMath . d }
2780
+ if ( jsMath . Browser . msieBlockDepthBug && ! isRule ) { d -= jsMath . d }
2799
2781
if ( d ) { style += 'vertical-align:' + this . Em ( - d ) }
2800
2782
return backspace + '<span class="blank" style="' + style + '"></span>' ;
2801
2783
} ,
@@ -2807,6 +2789,14 @@ jsMath.HTML = {
2807
2789
if ( h == null ) { h = jsMath . TeX . default_rule_thickness }
2808
2790
return this . Blank ( w , h , 0 , 1 ) ;
2809
2791
} ,
2792
+
2793
+ /*
2794
+ * Create a strut for measuring position of baseline
2795
+ */
2796
+ Strut : function ( h ) { return this . Blank ( 1 , h , 0 , 1 ) } ,
2797
+ msieStrut : function ( h ) {
2798
+ return '<img style="width:1px; height:' + this . Em ( h ) + '"/>'
2799
+ } ,
2810
2800
2811
2801
/*
2812
2802
* Add a <SPAN> tag to activate a specific CSS class
@@ -2896,7 +2886,7 @@ jsMath.HTML = {
2896
2886
if ( jsMath . Browser . msieAbsoluteBug ) { // for MSIE (Mac)
2897
2887
html = '<span style="position:relative;">' + html + '</span>' ;
2898
2888
}
2899
- html = '<span style="position:relative; '
2889
+ html = '<span style="position:relative;'
2900
2890
+ jsMath . Browser . msieInlineBlockFix
2901
2891
+ '">' + html + '</span>' ;
2902
2892
if ( jsMath . Browser . lineBreakBug )
@@ -2998,7 +2988,7 @@ jsMath.Add(jsMath.Box,{
2998
2988
var h = box . bd + box . bh ;
2999
2989
var html = jsMath . Typeset . AddClass ( box . tclass , box . html ) ;
3000
2990
html = jsMath . Typeset . AddStyle ( style , size , html ) ;
3001
- box . bd = jsMath . EmBoxFor ( html + jsMath . HTML . Blank ( 1 , h ) ) . h - h ;
2991
+ box . bd = jsMath . EmBoxFor ( html + jsMath . HTML . Strut ( h ) ) . h - h ;
3002
2992
box . bh = h - box . bd ;
3003
2993
if ( scale == 1 ) { c . bh = box . bh ; c . bd = box . bd }
3004
2994
}
@@ -3184,7 +3174,7 @@ jsMath.Add(jsMath.Box,{
3184
3174
3185
3175
html = jsMath . HTML . PlaceAbsolute ( jsMath . Typeset . AddClass ( top . tclass , top . c ) , 0 , 0 ) ;
3186
3176
h = rep . h + rep . d - .05 ; y = top . d - .05 + rep . h ;
3187
- ext = jsMath . Typeset . AddClass ( font , rep . c )
3177
+ ext = jsMath . Typeset . AddClass ( rep . tclass , rep . c )
3188
3178
for ( i = 0 ; i < n ; i ++ ) { html += jsMath . HTML . PlaceAbsolute ( ext , 0 , y + i * h ) }
3189
3179
html += jsMath . HTML . PlaceAbsolute ( jsMath . Typeset . AddClass ( mid . tclass , mid . c ) , 0 , y + n * h - rep . h + mid . h ) ;
3190
3180
y += n * h + mid . h + mid . d - .05 ;
@@ -3203,6 +3193,10 @@ jsMath.Add(jsMath.Box,{
3203
3193
3204
3194
var w = top . w ;
3205
3195
if ( nocenter ) { h = top . h ; y = 0 } else { h = H / 2 + a ; y = h - top . h }
3196
+ if ( jsMath . Controls . cookie . font === "unicode" ) {
3197
+ if ( jsMath . Browser . msie8HeightBug ) { y -= jsMath . hd }
3198
+ else if ( jsMath . Browser . msieBlockDepthBug ) { y += jsMath . d }
3199
+ }
3206
3200
html = jsMath . HTML . Absolute ( html , w , Font . h , "none" , - y ) ;
3207
3201
var box = new jsMath . Box ( 'html' , html , rep . w , h , H - h ) ;
3208
3202
box . bh = jsMath . TeX [ font ] . h ; box . bd = jsMath . TeX [ font ] . d ;
@@ -3401,6 +3395,7 @@ jsMath.Add(jsMath.Box,{
3401
3395
3402
3396
html = jsMath . HTML . Spacer ( addWidth * scale / 6 ) + html + jsMath . HTML . Spacer ( addWidth * scale / 6 ) ;
3403
3397
if ( jsMath . Browser . spanHeightVaries ) { y = h - jsMath . h } else { y = 0 }
3398
+ if ( jsMath . Browser . msie8HeightBug ) { y = d - jsMath . d }
3404
3399
html = jsMath . HTML . Absolute ( html , w , h + d , d , y ) ;
3405
3400
var box = new jsMath . Box ( 'html' , html , w + addWidth * scale / 3 , h , d ) ;
3406
3401
return box ;
@@ -4534,7 +4529,7 @@ jsMath.Package(jsMath.Typeset,{
4534
4529
item . html =
4535
4530
jsMath . HTML . Spacer ( lw - rw ) +
4536
4531
'<span style="position: relative; '
4537
- + 'top:' + jsMath . HTML . Em ( - item . y ) + ';'
4532
+ + 'top:' + jsMath . HTML . Em ( - item . y ) + '; '
4538
4533
+ 'left:' + jsMath . HTML . Em ( rw ) + '; width:' + jsMath . HTML . Em ( W ) + ';">' +
4539
4534
jsMath . HTML . Spacer ( - lw ) +
4540
4535
item . html +
@@ -6110,15 +6105,8 @@ jsMath.Package(jsMath.Parser,{
6110
6105
var html = box . html ;
6111
6106
if ( isSmall ) { // hide the extra size
6112
6107
if ( jsMath . Browser . allowAbsolute ) {
6113
- var y = 0 ;
6114
- if ( box . bh > jsMath . h + .001 ) { y = jsMath . h - box . bh }
6108
+ var y = ( box . bh > jsMath . h + .001 ? jsMath . h - box . bh : 0 ) ;
6115
6109
html = jsMath . HTML . Absolute ( html , box . w , jsMath . h , 0 , y ) ;
6116
- if ( jsMath . Browser . msie8HeightBug ) {
6117
- html = html . replace ( / r e l a t i v e / ,
6118
- "relative; height:" + jsMath . HTML . Em ( jsMath . hd ) + "; " +
6119
- "vertical-align:" + jsMath . HTML . Em ( - jsMath . d )
6120
- ) ;
6121
- }
6122
6110
} else if ( jsMath . Browser . valignBug ) {
6123
6111
// remove line height
6124
6112
html = '<span style="line-height:' + jsMath . HTML . Em ( jsMath . d ) + ';">'
0 commit comments