@@ -148,18 +148,13 @@ exports.compileAndLinkProps = function (vm, el, props) {
148
148
*
149
149
* If this is a fragment instance, we only need to compile 1.
150
150
*
151
- * This function does compile and link at the same time,
152
- * since root linkers can not be reused. It returns the
153
- * unlink function for potential context directives on the
154
- * container.
155
- *
156
151
* @param {Vue } vm
157
152
* @param {Element } el
158
153
* @param {Object } options
159
154
* @return {Function }
160
155
*/
161
156
162
- exports . compileAndLinkRoot = function ( vm , el , options ) {
157
+ exports . compileRoot = function ( el , options ) {
163
158
var containerAttrs = options . _containerAttrs
164
159
var replacerAttrs = options . _replacerAttrs
165
160
var contextLinkFn , replacerLinkFn
@@ -184,23 +179,25 @@ exports.compileAndLinkRoot = function (vm, el, options) {
184
179
}
185
180
}
186
181
187
- // link context scope dirs
188
- var context = vm . _context
189
- var contextDirs
190
- if ( context && contextLinkFn ) {
191
- contextDirs = linkAndCapture ( function ( ) {
192
- contextLinkFn ( context , el )
193
- } , context )
194
- }
182
+ return function rootLinkFn ( vm , el ) {
183
+ // link context scope dirs
184
+ var context = vm . _context
185
+ var contextDirs
186
+ if ( context && contextLinkFn ) {
187
+ contextDirs = linkAndCapture ( function ( ) {
188
+ contextLinkFn ( context , el )
189
+ } , context )
190
+ }
195
191
196
- // link self
197
- var selfDirs = linkAndCapture ( function ( ) {
198
- if ( replacerLinkFn ) replacerLinkFn ( vm , el )
199
- } , vm )
192
+ // link self
193
+ var selfDirs = linkAndCapture ( function ( ) {
194
+ if ( replacerLinkFn ) replacerLinkFn ( vm , el )
195
+ } , vm )
200
196
201
- // return the unlink function that tearsdown context
202
- // container directives.
203
- return makeUnlinkFn ( vm , selfDirs , context , contextDirs )
197
+ // return the unlink function that tearsdown context
198
+ // container directives.
199
+ return makeUnlinkFn ( vm , selfDirs , context , contextDirs )
200
+ }
204
201
}
205
202
206
203
/**
0 commit comments