This repository was archived by the owner on Jan 7, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ root = true
2+
3+ ; Unix-style newlines with a newline ending every file
4+ [* ]
5+ end_of_line = lf
6+ insert_final_newline = true
7+ charset = utf-8
8+
9+ ; JS
10+ [* .js ]
11+ indent_style = space
12+ indent_size = 4
13+ trim_trailing_whitespace = true
14+ insert_final_newline = true
Original file line number Diff line number Diff line change @@ -75,9 +75,9 @@ ToXml.prototype.openTag = function(key) {
7575 this . tagIncomplete = true ;
7676}
7777ToXml . prototype . addAttr = function ( key , val ) {
78- if ( this . options . sanitize ) {
79- val = sanitizer . sanitize ( val )
80- }
78+ if ( this . options . sanitize ) {
79+ val = sanitizer . sanitize ( val )
80+ }
8181 this . xml += ' ' + key + '="' + val + '"' ;
8282}
8383ToXml . prototype . addTextContent = function ( text ) {
@@ -99,13 +99,13 @@ function ToXml(options) {
9999 sanitize : false
100100 } ;
101101
102- if ( options ) {
103- for ( var opt in options ) {
104- defaultOpts [ opt ] = options [ opt ] ;
105- }
106- }
102+ if ( options ) {
103+ for ( var opt in options ) {
104+ defaultOpts [ opt ] = options [ opt ] ;
105+ }
106+ }
107107
108- this . options = defaultOpts ;
108+ this . options = defaultOpts ;
109109 this . xml = '' ;
110110 this . tagIncomplete = false ;
111111}
Original file line number Diff line number Diff line change 1- /**
2- * Simple sanitization. It is not intended to sanitize
3- * malicious element values.
4- *
5- * character | escaped
6- * < <
7- * > >
8- * ( (
9- * ) )
10- * # #
11- * & &
12- * " "
13- * ' '
14- */
15- var chars = {
16- '<' : '<' ,
17- '>' : '>' ,
18- '(' : '(' ,
19- ')' : ')' ,
20- '#' : '#' ,
21- '&' : '&' ,
22- '"' : '"' ,
23- "'" : '''
24- } ;
25-
26- exports . sanitize = function sanitize ( value ) {
27- if ( typeof value !== 'string' ) {
28- return value ;
29- }
30-
31- Object . keys ( chars ) . forEach ( function ( key ) {
32- value = value . replace ( key , chars [ key ] ) ;
33- } ) ;
34-
35- return value ;
36- }
1+ /**
2+ * Simple sanitization. It is not intended to sanitize
3+ * malicious element values.
4+ *
5+ * character | escaped
6+ * < <
7+ * > >
8+ * ( (
9+ * ) )
10+ * # #
11+ * & &
12+ * " "
13+ * ' '
14+ */
15+ var chars = {
16+ '<' : '<' ,
17+ '>' : '>' ,
18+ '(' : '(' ,
19+ ')' : ')' ,
20+ '#' : '#' ,
21+ '&' : '&' ,
22+ '"' : '"' ,
23+ "'" : '''
24+ } ;
25+
26+ exports . sanitize = function sanitize ( value ) {
27+ if ( typeof value !== 'string' ) {
28+ return value ;
29+ }
30+
31+ Object . keys ( chars ) . forEach ( function ( key ) {
32+ value = value . replace ( key , chars [ key ] ) ;
33+ } ) ;
34+
35+ return value ;
36+ }
You can’t perform that action at this time.
0 commit comments