@@ -148,18 +148,13 @@ exports.compileAndLinkProps = function (vm, el, props) {
148148 *
149149 * If this is a fragment instance, we only need to compile 1.
150150 *
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- *
156151 * @param {Vue } vm
157152 * @param {Element } el
158153 * @param {Object } options
159154 * @return {Function }
160155 */
161156
162- exports . compileAndLinkRoot = function ( vm , el , options ) {
157+ exports . compileRoot = function ( el , options ) {
163158 var containerAttrs = options . _containerAttrs
164159 var replacerAttrs = options . _replacerAttrs
165160 var contextLinkFn , replacerLinkFn
@@ -184,23 +179,25 @@ exports.compileAndLinkRoot = function (vm, el, options) {
184179 }
185180 }
186181
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+ }
195191
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 )
200196
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+ }
204201}
205202
206203/**
0 commit comments