@@ -7,47 +7,12 @@ import { normalizeChildren } from './helpers'
77import { renderState } from '../instance/render'
88import { warn , resolveAsset } from '../util/index'
99
10- export function renderElementWithChildren (
11- vnode : VNode | void ,
12- children : VNodeChildren | void
13- ) : VNode | Array < VNode > | void {
14- if ( vnode ) {
15- const componentOptions = vnode . componentOptions
16- if ( componentOptions ) {
17- if ( process . env . NODE_ENV !== 'production' &&
18- children && typeof children !== 'function' ) {
19- warn (
20- 'A component\'s children should be a function that returns the ' +
21- 'children array. This allows the component to track the children ' +
22- 'dependencies and optimizes re-rendering.'
23- )
24- }
25- const CtorOptions = componentOptions . Ctor . options
26- // functional component
27- if ( CtorOptions . functional ) {
28- return CtorOptions . render . call (
29- null ,
30- componentOptions . parent . $createElement , // h
31- componentOptions . propsData || { } , // props
32- normalizeChildren ( children ) // children
33- )
34- } else {
35- // normal component
36- componentOptions . children = children
37- }
38- } else {
39- // normal element
40- vnode . setChildren ( normalizeChildren ( children ) )
41- }
42- }
43- return vnode
44- }
45-
46- export function renderElement (
10+ export function createElement (
4711 tag ?: string | Class < Component > | Function | Object ,
4812 data ?: VNodeData ,
13+ children ?: VNodeChildren | void ,
4914 namespace ?: string
50- ) : VNode | void {
15+ ) : VNode | Array < VNode > | void {
5116 // make sure to expose real self instead of proxy
5217 const context : Component = this . _self
5318 const parent : ?Component = renderState . activeInstance
@@ -67,12 +32,12 @@ export function renderElement (
6732 let Ctor
6833 if ( config . isReservedTag ( tag ) ) {
6934 return new VNode (
70- tag , data ,
71- undefined , undefined , undefined ,
35+ tag , data , normalizeChildren ( children ) ,
36+ undefined , undefined ,
7237 namespace , context , host
7338 )
7439 } else if ( ( Ctor = resolveAsset ( context . $options , 'components' , tag ) ) ) {
75- return createComponent ( Ctor , data , parent , context , host , tag )
40+ return createComponent ( Ctor , data , parent , context , host , children , tag )
7641 } else {
7742 if ( process . env . NODE_ENV !== 'production' ) {
7843 if (
@@ -88,20 +53,12 @@ export function renderElement (
8853 }
8954 }
9055 return new VNode (
91- tag , data ,
92- undefined , undefined , undefined ,
56+ tag , data , normalizeChildren ( children ) ,
57+ undefined , undefined ,
9358 namespace , context , host
9459 )
9560 }
9661 } else {
97- return createComponent ( tag , data , parent , context , host )
62+ return createComponent ( tag , data , parent , context , host , children )
9863 }
9964}
100-
101- export function renderStatic ( index ? : number ) : Object | void {
102- return this . _staticTrees [ index ] || (
103- this . _staticTrees [ index ] = this . $options . staticRenderFns [ index ] . call (
104- this . _renderProxy
105- )
106- )
107- }
0 commit comments