@@ -102,11 +102,14 @@ define([
102102 // grid row index
103103 // returns:
104104 // html for a given grid cell
105- var f , i = this . grid . edit . info , d = this . get ? this . get ( inRowIndex , inItem ) : ( this . value || this . defaultValue ) ;
106- d = ( d && d . replace && this . grid . escapeHTMLInData ) ? d . replace ( / & / g, '&' ) . replace ( / < / g, '<' ) : d ;
107- if ( this . editable && ( this . alwaysEditing || ( i . rowIndex == inRowIndex && i . cell == this ) ) ) {
105+ var i = this . grid . edit . info ;
106+ var d = this . get ? this . get ( inRowIndex , inItem ) : ( this . value || this . defaultValue ) ;
107+ if ( d && d . replace && this . grid . escapeHTMLInData ) {
108+ d = d . replace ( / & / g, '&' ) . replace ( / < / g, '<' ) ;
109+ }
110+ if ( this . editable && ( this . alwaysEditing || ( i . rowIndex == inRowIndex && i . cell == this ) ) ) {
108111 return this . formatEditing ( i . value ? i . value : d , inRowIndex ) ;
109- } else {
112+ } else {
110113 return this . _defaultFormat ( d , [ d , inRowIndex , this ] ) ;
111114 }
112115 } ,
@@ -329,6 +332,10 @@ define([
329332 keyFilter : null ,
330333 formatEditing : function ( inDatum , inRowIndex ) {
331334 this . needFormatNode ( inDatum , inRowIndex ) ;
335+ if ( inDatum && inDatum . replace ) {
336+ // escape quotes to avoid XSS
337+ inDatum = inDatum . replace ( / " / g, '"' )
338+ }
332339 return '<input class="dojoxGridInput" type="text" value="' + inDatum + '">' ;
333340 } ,
334341 formatNode : function ( inNode , inDatum , inRowIndex ) {
@@ -478,4 +485,4 @@ define([
478485
479486 return BaseCell ;
480487
481- } ) ;
488+ } ) ;
0 commit comments