Skip to content

Commit 65b193d

Browse files
authored
optimization: use existing loop value for props.children
1 parent 76eda75 commit 65b193d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ function renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
148148
let s = '', propChildren, html;
149149

150150
if (props) {
151-
propChildren = props.children;
152-
153151
let attrs = Object.keys(props);
154152

155153
// allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)
@@ -158,7 +156,10 @@ function renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
158156
for (let i=0; i<attrs.length; i++) {
159157
let name = attrs[i],
160158
v = props[name];
161-
if (name==='children') continue;
159+
if (name==='children') {
160+
propChildren = v;
161+
continue;
162+
}
162163

163164
if (name.match(/[\s\n\\/='"\0<>]/)) continue;
164165

0 commit comments

Comments
 (0)