@@ -178,7 +178,7 @@ function hypertext(render, postprocess) {
178178 switch ( state ) {
179179 case STATE_RAWTEXT : {
180180 if ( value != null ) {
181- const text = value + "" ;
181+ const text = ` ${ value } ` ;
182182 if ( isEscapableRawText ( tagName ) ) {
183183 string += text . replace ( / [ < ] / g, entity ) ;
184184 } else if ( new RegExp ( `</${ tagName } [\\s>/]` , "i" ) . test ( string . slice ( - tagName . length - 2 ) + text ) ) {
@@ -198,7 +198,7 @@ function hypertext(render, postprocess) {
198198 string += "<!--::" + j + "-->" ;
199199 nodeFilter |= SHOW_COMMENT ;
200200 } else {
201- string += ( value + "" ) . replace ( / [ < & ] / g, entity ) ;
201+ string += ` ${ value } ` . replace ( / [ < & ] / g, entity ) ;
202202 }
203203 break ;
204204 }
@@ -210,7 +210,7 @@ function hypertext(render, postprocess) {
210210 string = string . slice ( 0 , attributeNameStart - strings [ j - 1 ] . length ) ;
211211 break ;
212212 }
213- if ( value === true || ( text = value + "" ) === "" ) {
213+ if ( value === true || ( text = ` ${ value } ` ) === "" ) {
214214 string += "''" ;
215215 break ;
216216 }
@@ -221,21 +221,21 @@ function hypertext(render, postprocess) {
221221 break ;
222222 }
223223 }
224- if ( text === undefined ) text = value + "" ;
224+ if ( text === undefined ) text = ` ${ value } ` ;
225225 if ( text === "" ) throw new Error ( "unsafe unquoted empty string" ) ;
226226 string += text . replace ( / ^ [ ' " ] | [ \s > & ] / g, entity ) ;
227227 break ;
228228 }
229229 case STATE_ATTRIBUTE_VALUE_UNQUOTED : {
230- string += ( value + "" ) . replace ( / [ \s > & ] / g, entity ) ;
230+ string += ` ${ value } ` . replace ( / [ \s > & ] / g, entity ) ;
231231 break ;
232232 }
233233 case STATE_ATTRIBUTE_VALUE_SINGLE_QUOTED : {
234- string += ( value + "" ) . replace ( / [ ' & ] / g, entity ) ;
234+ string += ` ${ value } ` . replace ( / [ ' & ] / g, entity ) ;
235235 break ;
236236 }
237237 case STATE_ATTRIBUTE_VALUE_DOUBLE_QUOTED : {
238- string += ( value + "" ) . replace ( / [ " & ] / g, entity ) ;
238+ string += ` ${ value } ` . replace ( / [ " & ] / g, entity ) ;
239239 break ;
240240 }
241241 case STATE_BEFORE_ATTRIBUTE_NAME : {
0 commit comments