* Abstraction for a partially-compiled fragment. * Can optionally compile content with a child scope. * * @param {Function} linker * @param {Vue} vm * @param {DocumentFragment} frag * @param {Vue} [host] * @param {Object} [scope] * @param {Fragment} [parentFrag]
(linker, vm, frag, host, scope, parentFrag)
| 3749 | * @param {Fragment} [parentFrag] |
| 3750 | */ |
| 3751 | function Fragment(linker, vm, frag, host, scope, parentFrag) { |
| 3752 | this.children = []; |
| 3753 | this.childFrags = []; |
| 3754 | this.vm = vm; |
| 3755 | this.scope = scope; |
| 3756 | this.inserted = false; |
| 3757 | this.parentFrag = parentFrag; |
| 3758 | if (parentFrag) { |
| 3759 | parentFrag.childFrags.push(this); |
| 3760 | } |
| 3761 | this.unlink = linker(vm, frag, host, scope, this); |
| 3762 | var single = this.single = frag.childNodes.length === 1 && |
| 3763 | // do not go single mode if the only node is an anchor |
| 3764 | !frag.childNodes[0].__v_anchor; |
| 3765 | if (single) { |
| 3766 | this.node = frag.childNodes[0]; |
| 3767 | this.before = singleBefore; |
| 3768 | this.remove = singleRemove; |
| 3769 | } else { |
| 3770 | this.node = createAnchor('fragment-start'); |
| 3771 | this.end = createAnchor('fragment-end'); |
| 3772 | this.frag = frag; |
| 3773 | prepend(this.node, frag); |
| 3774 | frag.appendChild(this.end); |
| 3775 | this.before = multiBefore; |
| 3776 | this.remove = multiRemove; |
| 3777 | } |
| 3778 | this.node.__v_frag = this; |
| 3779 | } |
| 3780 | |
| 3781 | /** |
| 3782 | * Call attach/detach for all components contained within |
nothing calls this directly
no test coverage detected