@@ -21,7 +21,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
2121 if ( ch == "<" ) {
2222 if ( stream . eat ( "!" ) ) {
2323 if ( stream . eat ( "[" ) ) {
24- if ( stream . match ( "CDATA[" ) ) return chain ( inBlock ( "atom" , "]]>" ) ) ;
24+ if ( stream . match ( "CDATA[" ) ) return chain ( inBlock ( "atom" , "]]>" , "!cdata" ) ) ;
2525 else return null ;
2626 }
2727 else if ( stream . match ( "--" ) ) return chain ( inBlock ( "comment" , "-->" ) ) ;
@@ -90,7 +90,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
9090 } ;
9191 }
9292
93- function inBlock ( style , terminator ) {
93+ function inBlock ( style , terminator , tp ) {
9494 return function ( stream , state ) {
9595 while ( ! stream . eol ( ) ) {
9696 if ( stream . match ( terminator ) ) {
@@ -99,6 +99,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
9999 }
100100 stream . next ( ) ;
101101 }
102+ type = tp ;
102103 return style ;
103104 } ;
104105 }
@@ -158,7 +159,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
158159 if ( err ) setStyle = "error" ;
159160 return cont ( endclosetag ( err ) ) ;
160161 }
161- else if ( type == "string " ) {
162+ else if ( type == "!cdata " ) {
162163 if ( ! curState . context || curState . context . name != "!cdata" ) pushContext ( "!cdata" ) ;
163164 if ( curState . tokenize == inText ) popContext ( ) ;
164165 return cont ( ) ;
0 commit comments