@@ -178,7 +178,7 @@ function hypertext(render, postprocess) {
178
178
switch ( state ) {
179
179
case STATE_RAWTEXT : {
180
180
if ( value != null ) {
181
- const text = value + "" ;
181
+ const text = ` ${ value } ` ;
182
182
if ( isEscapableRawText ( tagName ) ) {
183
183
string += text . replace ( / [ < ] / g, entity ) ;
184
184
} else if ( new RegExp ( `</${ tagName } [\\s>/]` , "i" ) . test ( string . slice ( - tagName . length - 2 ) + text ) ) {
@@ -198,7 +198,7 @@ function hypertext(render, postprocess) {
198
198
string += "<!--::" + j + "-->" ;
199
199
nodeFilter |= SHOW_COMMENT ;
200
200
} else {
201
- string += ( value + "" ) . replace ( / [ < & ] / g, entity ) ;
201
+ string += ` ${ value } ` . replace ( / [ < & ] / g, entity ) ;
202
202
}
203
203
break ;
204
204
}
@@ -210,7 +210,7 @@ function hypertext(render, postprocess) {
210
210
string = string . slice ( 0 , attributeNameStart - strings [ j - 1 ] . length ) ;
211
211
break ;
212
212
}
213
- if ( value === true || ( text = value + "" ) === "" ) {
213
+ if ( value === true || ( text = ` ${ value } ` ) === "" ) {
214
214
string += "''" ;
215
215
break ;
216
216
}
@@ -221,21 +221,21 @@ function hypertext(render, postprocess) {
221
221
break ;
222
222
}
223
223
}
224
- if ( text === undefined ) text = value + "" ;
224
+ if ( text === undefined ) text = ` ${ value } ` ;
225
225
if ( text === "" ) throw new Error ( "unsafe unquoted empty string" ) ;
226
226
string += text . replace ( / ^ [ ' " ] | [ \s > & ] / g, entity ) ;
227
227
break ;
228
228
}
229
229
case STATE_ATTRIBUTE_VALUE_UNQUOTED : {
230
- string += ( value + "" ) . replace ( / [ \s > & ] / g, entity ) ;
230
+ string += ` ${ value } ` . replace ( / [ \s > & ] / g, entity ) ;
231
231
break ;
232
232
}
233
233
case STATE_ATTRIBUTE_VALUE_SINGLE_QUOTED : {
234
- string += ( value + "" ) . replace ( / [ ' & ] / g, entity ) ;
234
+ string += ` ${ value } ` . replace ( / [ ' & ] / g, entity ) ;
235
235
break ;
236
236
}
237
237
case STATE_ATTRIBUTE_VALUE_DOUBLE_QUOTED : {
238
- string += ( value + "" ) . replace ( / [ " & ] / g, entity ) ;
238
+ string += ` ${ value } ` . replace ( / [ " & ] / g, entity ) ;
239
239
break ;
240
240
}
241
241
case STATE_BEFORE_ATTRIBUTE_NAME : {
0 commit comments