@@ -53,12 +53,12 @@ MathJax.Extension.mml2jax = {
53
53
//
54
54
// Handle all math tags with no namespaces
55
55
//
56
- this . AppendMathElements ( mathArray , element . getElementsByTagName ( "math" ) ) ;
56
+ mathArray . push . apply ( mathArray , element . getElementsByTagName ( "math" ) ) ;
57
57
//
58
58
// Handle math with namespaces in XHTML
59
59
//
60
60
if ( element . getElementsByTagNameNS )
61
- { this . AppendMathElements ( mathArray , element . getElementsByTagNameNS ( this . MMLnamespace , "math" ) ) }
61
+ { mathArray . push . apply ( mathArray , element . getElementsByTagNameNS ( this . MMLnamespace , "math" ) ) }
62
62
//
63
63
// Handle math with namespaces in HTML
64
64
//
@@ -71,7 +71,7 @@ MathJax.Extension.mml2jax = {
71
71
for ( i = 0 , m = document . namespaces . length ; i < m ; i ++ ) {
72
72
var ns = document . namespaces [ i ] ;
73
73
if ( ns . urn === this . MMLnamespace )
74
- { this . AppendMathElements ( mathArray , element . getElementsByTagName ( ns . name + ":math" ) ) }
74
+ { mathArray . push . apply ( mathArray , element . getElementsByTagName ( ns . name + ":math" ) ) }
75
75
}
76
76
} catch ( err ) { }
77
77
} else {
@@ -83,36 +83,30 @@ MathJax.Extension.mml2jax = {
83
83
for ( i = 0 , m = html . attributes . length ; i < m ; i ++ ) {
84
84
var attr = html . attributes [ i ] ;
85
85
if ( attr . nodeName . substr ( 0 , 6 ) === "xmlns:" && attr . nodeValue === this . MMLnamespace )
86
- { this . AppendMathElements ( mathArray , element . getElementsByTagName ( attr . nodeName . substr ( 6 ) + ":math" ) ) }
86
+ { mathArray . push . apply ( mathArray , element . getElementsByTagName ( attr . nodeName . substr ( 6 ) + ":math" ) ) }
87
87
}
88
88
}
89
89
}
90
90
this . ProcessMathArray ( mathArray ) ;
91
91
} ,
92
92
93
- AppendMathElements : function ( mathArray , math ) {
94
- if ( math . length ) {
95
- for ( var i = math . length - 1 ; i >= 0 ; i -- ) { mathArray . push ( math [ i ] ) }
96
- }
97
- } ,
98
-
99
93
ProcessMathArray : function ( math ) {
100
- var i ;
101
- if ( math . length ) {
94
+ var i , m = math . length ;
95
+ if ( m ) {
102
96
if ( this . MathTagBug ) {
103
- for ( i = math . length - 1 ; i >= 0 ; i -- ) {
97
+ for ( i = 0 ; i < m ; i ++ ) {
104
98
if ( math [ i ] . nodeName === "MATH" ) { this . ProcessMathFlattened ( math [ i ] ) }
105
99
else { this . ProcessMath ( math [ i ] ) }
106
100
}
107
101
} else {
108
- for ( i = math . length - 1 ; i >= 0 ; i -- ) { this . ProcessMath ( math [ i ] ) }
102
+ for ( i = 0 ; i < m ; i ++ ) { this . ProcessMath ( math [ i ] ) }
109
103
}
110
104
}
111
105
} ,
112
106
113
107
ProcessMath : function ( math ) {
114
108
var parent = math . parentNode ;
115
- if ( ! parent || parent . className === "MathJax_Preview" ) return ;
109
+ if ( ! parent || parent . className === MathJax . Hub . config . preRemoveClass ) return ;
116
110
var script = document . createElement ( "script" ) ;
117
111
script . type = "math/mml" ;
118
112
parent . insertBefore ( script , math ) ;
@@ -132,7 +126,7 @@ MathJax.Extension.mml2jax = {
132
126
133
127
ProcessMathFlattened : function ( math ) {
134
128
var parent = math . parentNode ;
135
- if ( ! parent || parent . className === "MathJax_Preview" ) return ;
129
+ if ( ! parent || parent . className === MathJax . Hub . config . preRemoveClass ) return ;
136
130
var script = document . createElement ( "script" ) ;
137
131
script . type = "math/mml" ;
138
132
parent . insertBefore ( script , math ) ;
0 commit comments