@@ -85,15 +85,10 @@ function _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
8585 if ( Array . isArray ( vnode ) ) {
8686 let rendered = '' ;
8787 for ( let i = 0 ; i < vnode . length ; i ++ ) {
88- if ( pretty && i > 0 ) rendered += '\n' ;
89- rendered += _renderToString (
90- vnode [ i ] ,
91- context ,
92- opts ,
93- inner ,
94- isSvgMode ,
95- selectValue
96- ) ;
88+ if ( pretty && i > 0 ) rendered = rendered + '\n' ;
89+ rendered =
90+ rendered +
91+ _renderToString ( vnode [ i ] , context , opts , inner , isSvgMode , selectValue ) ;
9792 }
9893 return rendered ;
9994 }
@@ -289,7 +284,7 @@ function _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
289284 opts . attributeHook &&
290285 opts . attributeHook ( name , v , context , opts , isComponent ) ;
291286 if ( hooked || hooked === '' ) {
292- s += hooked ;
287+ s = s + hooked ;
293288 continue ;
294289 }
295290
@@ -303,7 +298,7 @@ function _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
303298 v = name ;
304299 // in non-xml mode, allow boolean attributes
305300 if ( ! opts || ! opts . xml ) {
306- s += ' ' + name ;
301+ s = s + ' ' + name ;
307302 continue ;
308303 }
309304 }
@@ -319,10 +314,10 @@ function _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
319314 // and the <option> doesn't already have a selected attribute on it
320315 typeof props . selected === 'undefined'
321316 ) {
322- s += ` selected` ;
317+ s = s + ` selected` ;
323318 }
324319 }
325- s += ` ${ name } ="${ encodeEntities ( v ) } "` ;
320+ s = s + ` ${ name } ="${ encodeEntities ( v ) } "` ;
326321 }
327322 }
328323 }
@@ -331,10 +326,10 @@ function _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
331326 if ( pretty ) {
332327 let sub = s . replace ( / \n \s * / , ' ' ) ;
333328 if ( sub !== s && ! ~ sub . indexOf ( '\n' ) ) s = sub ;
334- else if ( pretty && ~ s . indexOf ( '\n' ) ) s += '\n' ;
329+ else if ( pretty && ~ s . indexOf ( '\n' ) ) s = s + '\n' ;
335330 }
336331
337- s += '>' ;
332+ s = s + '>' ;
338333
339334 if ( UNSAFE_NAME . test ( nodeName ) )
340335 throw new Error ( `${ nodeName } is not a valid HTML tag name in ${ s } ` ) ;
@@ -350,7 +345,7 @@ function _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
350345 if ( pretty && isLargeString ( html ) ) {
351346 html = '\n' + indentChar + indent ( html , indentChar ) ;
352347 }
353- s += html ;
348+ s = s + html ;
354349 } else if (
355350 propChildren != null &&
356351 getChildren ( ( children = [ ] ) , propChildren ) . length
@@ -407,16 +402,16 @@ function _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
407402 }
408403
409404 if ( pieces . length || html ) {
410- s += pieces . join ( '' ) ;
405+ s = s + pieces . join ( '' ) ;
411406 } else if ( opts && opts . xml ) {
412407 return s . substring ( 0 , s . length - 1 ) + ' />' ;
413408 }
414409
415410 if ( isVoid && ! children && ! html ) {
416411 s = s . replace ( / > $ / , ' />' ) ;
417412 } else {
418- if ( pretty && ~ s . indexOf ( '\n' ) ) s += '\n' ;
419- s += `</${ nodeName } >` ;
413+ if ( pretty && ~ s . indexOf ( '\n' ) ) s = s + '\n' ;
414+ s = s + `</${ nodeName } >` ;
420415 }
421416
422417 return s ;
0 commit comments