File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -115,22 +115,28 @@ window.cls.Helpers = function()
115115
116116 this . escapeTextHtml = ( function ( )
117117 {
118- var re_amp = / & / g, re_lt = / < / g;
118+ var re_amp = / & / g;
119+ var re_lt = / < / g;
120+ var re_cd_end = / ] ] > / g;
119121 return function ( str )
120122 {
121- return str ? str . replace ( re_amp , "&" ) . replace ( re_lt , "<" ) : str ;
123+ return str ? str . replace ( re_amp , "&" )
124+ . replace ( re_lt , "<" )
125+ . replace ( re_cd_end , "]]>" )
126+ : str ;
122127 }
123128 } ) ( ) ;
124129
125130 this . escapeAttributeHtml = ( function ( )
126131 {
127- var re_amp = / & / g, re_lt = / < / g, re_quot = / " / g, re_s_quot = / ' / g;
132+ var re_quot = / " / g;
133+ var re_apos = / ' / g;
128134 return function ( str )
129135 {
130- return str . replace ( re_amp , "&" )
131- . replace ( re_lt , "< ;" )
132- . replace ( re_quot , "" ;" )
133- . replace ( re_s_quot , "'" ) ;
136+ return str ? this . escapeTextHtml ( str )
137+ . replace ( re_quot , "" ;" )
138+ . replace ( re_apos , "' ;" )
139+ : str ;
134140 }
135141 } ) ( ) ;
136142
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ cls.SimpleJSParser.prototype = new function()
5757 * @param {String } script_source The script string.
5858 * @param {Function } ontoken. Signature of the callback is (token_type, token).
5959 * @param {String } escape. Optional. Currently supports only "html"
60- * to escape "<" and "&" to "<" and "&".
60+ * to escape "<", ">" and "&" to "<", ">" (for ]]>) and "&".
6161 */
6262 this . tokenize = function ( script_source , ontoken , escape , start_state ) { } ;
6363
@@ -355,6 +355,7 @@ cls.SimpleJSParser.prototype = new function()
355355 var ESCAPE =
356356 {
357357 '<' : '<' ,
358+ '>' : '>' ,
358359 '&' : '&'
359360 }
360361 var default_parser = function ( c )
You can’t perform that action at this time.
0 commit comments