@@ -34,31 +34,15 @@ export function createElement(type, props, children) {
34
34
normalizedProps . children = children ;
35
35
}
36
36
37
- return createVNode ( type , normalizedProps , key , ref , 0 ) ;
38
- }
39
-
40
- /**
41
- * Create a VNode (used internally by Preact)
42
- * @param {import('./internal').VNode["type"] } type The node name or Component
43
- * Constructor for this virtual node
44
- * @param {object | string | number | null } props The properties of this virtual node.
45
- * If this virtual node represents a text node, this is the text of the node (string or number).
46
- * @param {string | number | null } key The key for this virtual node, used when
47
- * diffing it against its children
48
- * @param {import('./internal').VNode["ref"] } ref The ref property that will
49
- * receive a reference to its created child
50
- * @returns {import('./internal').VNode }
51
- */
52
- export function createVNode ( type , props , key , ref , original ) {
53
37
// V8 seems to be better at detecting type shapes if the object is allocated from the same call site
54
38
// Do not inline into createElement and coerceToVNode!
55
39
const vnode = {
56
40
type,
57
- props,
41
+ props : normalizedProps ,
58
42
key,
59
43
ref,
60
44
constructor : undefined ,
61
- _vnodeId : original || ++ vnodeId
45
+ _vnodeId : ++ vnodeId
62
46
} ;
63
47
64
48
if ( options . vnode != null ) options . vnode ( vnode ) ;
@@ -77,7 +61,7 @@ export function normalizeToVNode(childVNode) {
77
61
}
78
62
if ( type === 'object' ) {
79
63
if ( Array . isArray ( childVNode ) ) {
80
- return createVNode ( Fragment , { children : childVNode } , null , null , 0 ) ;
64
+ return createElement ( Fragment , null , childVNode ) ;
81
65
}
82
66
} else if ( type !== 'string' && type !== 'function' ) {
83
67
return String ( childVNode ) ;
0 commit comments