1- // import { toChildArray } from 'preact';
2- import { encodeEntities , indent , isLargeString , styleObjToCss , assign , getChildren /*, getNodeProps*/ } from './util' ;
1+ import { encodeEntities , indent , isLargeString , styleObjToCss , assign , getChildren } from './util' ;
32import { ENABLE_PRETTY } from '../env' ;
43
54const SHALLOW = { shallow : true } ;
@@ -40,7 +39,7 @@ function renderToString(vnode, context, opts, inner, isSvgMode) {
4039 }
4140
4241 let nodeName = vnode . type ,
43- attributes = vnode . props ,
42+ props = vnode . props ,
4443 isComponent = false ;
4544 context = context || { } ;
4645 opts = opts || { } ;
@@ -60,8 +59,7 @@ function renderToString(vnode, context, opts, inner, isSvgMode) {
6059 nodeName = getComponentName ( nodeName ) ;
6160 }
6261 else {
63- let props = vnode . props , //props = getNodeProps(vnode),
64- rendered ;
62+ let rendered ;
6563
6664 if ( ! nodeName . prototype || typeof nodeName . prototype . render !== 'function' ) {
6765 // stateless functional components
@@ -90,23 +88,23 @@ function renderToString(vnode, context, opts, inner, isSvgMode) {
9088 // render JSX to HTML
9189 let s = '' , html ;
9290
93- if ( attributes ) {
94- let attrs = Object . keys ( attributes ) ;
91+ if ( props ) {
92+ let attrs = Object . keys ( props ) ;
9593
9694 // allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)
9795 if ( opts && opts . sortAttributes === true ) attrs . sort ( ) ;
9896
9997 for ( let i = 0 ; i < attrs . length ; i ++ ) {
10098 let name = attrs [ i ] ,
101- v = attributes [ name ] ;
99+ v = props [ name ] ;
102100 if ( name === 'children' ) continue ;
103101
104102 if ( name . match ( / [ \s \n \\ / = ' " \0 < > ] / ) ) continue ;
105103
106104 if ( ! ( opts && opts . allAttributes ) && ( name === 'key' || name === 'ref' ) ) continue ;
107105
108106 if ( name === 'className' ) {
109- if ( attributes . class ) continue ;
107+ if ( props . class ) continue ;
110108 name = 'class' ;
111109 }
112110 else if ( isSvgMode && name . match ( / ^ x l i n k : ? ./ ) ) {
@@ -163,7 +161,7 @@ function renderToString(vnode, context, opts, inner, isSvgMode) {
163161 }
164162 s += html ;
165163 }
166- else if ( vnode . props && getChildren ( children = [ ] , vnode . props . children ) . length ) {
164+ else if ( props && getChildren ( children = [ ] , props . children ) . length ) {
167165 let hasLarge = pretty && ~ s . indexOf ( '\n' ) ;
168166 for ( let i = 0 ; i < children . length ; i ++ ) {
169167 let child = children [ i ] ;
0 commit comments