1
- var _ = require ( '../util' )
2
1
var compiler = require ( '../compiler' )
2
+ import { isTemplate } from '../util'
3
3
import { parseTemplate , cloneNode } from '../parsers/template'
4
- var Fragment = require ( './fragment' )
5
- var Cache = require ( '../cache' )
6
- var linkerCache = new Cache ( 5000 )
4
+ import Fragment from './fragment'
5
+ import Cache from '../cache'
6
+
7
+ const linkerCache = new Cache ( 5000 )
7
8
8
9
/**
9
10
* A factory that can be used to create instances of a
@@ -13,11 +14,11 @@ var linkerCache = new Cache(5000)
13
14
* @param {Element|String } el
14
15
*/
15
16
16
- function FragmentFactory ( vm , el ) {
17
+ export default function FragmentFactory ( vm , el ) {
17
18
this . vm = vm
18
19
var template
19
20
var isString = typeof el === 'string'
20
- if ( isString || _ . isTemplate ( el ) ) {
21
+ if ( isString || isTemplate ( el ) ) {
21
22
template = parseTemplate ( el , true )
22
23
} else {
23
24
template = document . createDocumentFragment ( )
@@ -52,5 +53,3 @@ FragmentFactory.prototype.create = function (host, scope, parentFrag) {
52
53
var frag = cloneNode ( this . template )
53
54
return new Fragment ( this . linker , this . vm , frag , host , scope , parentFrag )
54
55
}
55
-
56
- module . exports = FragmentFactory
0 commit comments