File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ tree.Quoted.prototype = {
10
10
toString : function ( quotes ) {
11
11
var xmlvalue = this . value . replace ( / & / g, '&' ) ;
12
12
xmlvalue = xmlvalue . replace ( / \' / g, ''' ) ;
13
+ xmlvalue = xmlvalue . replace ( / \" / g, '"' ) ;
14
+ xmlvalue = xmlvalue . replace ( / \< / g, '<' ) ;
15
+ xmlvalue = xmlvalue . replace ( / \> / g, '>' ) ;
13
16
return ( quotes === true ) ? "'" + xmlvalue + "'" : this . value ;
14
17
} ,
15
18
Original file line number Diff line number Diff line change @@ -5,19 +5,19 @@ require('../lib/carto/tree/quoted');
5
5
describe ( 'Quoted' , function ( ) {
6
6
describe ( 'basic functionality' , function ( ) {
7
7
it ( 'should be constructed' , function ( ) {
8
- var f = new tree . Quoted ( "Tom's & quoted" ) ;
8
+ var f = new tree . Quoted ( "Tom's & \"< quoted>\" " ) ;
9
9
assert . ok ( f ) ;
10
10
assert . equal ( f . is , 'string' ) ;
11
11
} ) ;
12
12
it ( 'should produce normal output' , function ( ) {
13
- var f = new tree . Quoted ( "Tom's & quoted" ) ;
13
+ var f = new tree . Quoted ( "Tom's & \"< quoted>\" " ) ;
14
14
assert . ok ( f ) ;
15
- assert . equal ( f . toString ( ) , "Tom's & quoted" ) ;
15
+ assert . equal ( f . toString ( ) , "Tom's & \"< quoted>\" " ) ;
16
16
} ) ;
17
17
it ( 'should produce xml-friendly output' , function ( ) {
18
- var f = new tree . Quoted ( "Tom's & quoted" ) ;
18
+ var f = new tree . Quoted ( "Tom's & \"< quoted>\" " ) ;
19
19
assert . ok ( f ) ;
20
- assert . equal ( f . toString ( true ) , "'Tom's & quoted'" ) ;
20
+ assert . equal ( f . toString ( true ) , "'Tom's & "< quoted>" '" ) ;
21
21
} ) ;
22
22
} ) ;
23
23
} ) ;
You can’t perform that action at this time.
0 commit comments