@@ -187,6 +187,10 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
187187 } ;
188188 }
189189
190+ function lower ( tagName ) {
191+ return tagName && tagName . toLowerCase ( ) ;
192+ }
193+
190194 function Context ( state , tagName , startOfLine ) {
191195 this . prev = state . context ;
192196 this . tagName = tagName || "" ;
@@ -205,8 +209,8 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
205209 return ;
206210 }
207211 parentTagName = state . context . tagName ;
208- if ( ! config . contextGrabbers . hasOwnProperty ( parentTagName . toLowerCase ( ) ) ||
209- ! config . contextGrabbers [ parentTagName . toLowerCase ( ) ] . hasOwnProperty ( nextTagName . toLowerCase ( ) ) ) {
212+ if ( ! config . contextGrabbers . hasOwnProperty ( lower ( parentTagName ) ) ||
213+ ! config . contextGrabbers [ lower ( parentTagName ) ] . hasOwnProperty ( lower ( nextTagName ) ) ) {
210214 return ;
211215 }
212216 popContext ( state ) ;
@@ -240,7 +244,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
240244 if ( type == "word" ) {
241245 var tagName = stream . current ( ) ;
242246 if ( state . context && state . context . tagName != tagName &&
243- config . implicitlyClosed . hasOwnProperty ( state . context . tagName . toLowerCase ( ) ) )
247+ config . implicitlyClosed . hasOwnProperty ( lower ( state . context . tagName ) ) )
244248 popContext ( state ) ;
245249 if ( ( state . context && state . context . tagName == tagName ) || config . matchClosing === false ) {
246250 setStyle = "tag" ;
@@ -279,7 +283,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
279283 var tagName = state . tagName , tagStart = state . tagStart ;
280284 state . tagName = state . tagStart = null ;
281285 if ( type == "selfcloseTag" ||
282- config . autoSelfClosers . hasOwnProperty ( tagName . toLowerCase ( ) ) ) {
286+ config . autoSelfClosers . hasOwnProperty ( lower ( tagName ) ) ) {
283287 maybePopContext ( state , tagName ) ;
284288 } else {
285289 maybePopContext ( state , tagName ) ;
@@ -359,16 +363,16 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
359363 if ( context . tagName == tagAfter [ 2 ] ) {
360364 context = context . prev ;
361365 break ;
362- } else if ( config . implicitlyClosed . hasOwnProperty ( context . tagName . toLowerCase ( ) ) ) {
366+ } else if ( config . implicitlyClosed . hasOwnProperty ( lower ( context . tagName ) ) ) {
363367 context = context . prev ;
364368 } else {
365369 break ;
366370 }
367371 }
368372 } else if ( tagAfter ) { // Opening tag spotted
369373 while ( context ) {
370- var grabbers = config . contextGrabbers [ context . tagName . toLowerCase ( ) ] ;
371- if ( grabbers && grabbers . hasOwnProperty ( tagAfter [ 2 ] . toLowerCase ( ) ) )
374+ var grabbers = config . contextGrabbers [ lower ( context . tagName ) ] ;
375+ if ( grabbers && grabbers . hasOwnProperty ( lower ( tagAfter [ 2 ] ) ) )
372376 context = context . prev ;
373377 else
374378 break ;
0 commit comments