Skip to content

Commit 974c5c3

Browse files
committed
rename block instance -> fragment instance
1 parent 9abcfd2 commit 974c5c3

File tree

10 files changed

+36
-36
lines changed

10 files changed

+36
-36
lines changed

src/api/dom.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ exports.$remove = function (cb, withTransition) {
101101
if (cb) cb()
102102
}
103103
if (
104-
this._isBlock &&
104+
this._isFragment &&
105105
!this._blockFragment.hasChildNodes()
106106
) {
107107
op = withTransition === false
@@ -139,7 +139,7 @@ function insert (vm, target, cb, withTransition, op1, op2) {
139139
!targetIsDetached &&
140140
!vm._isAttached &&
141141
!_.inDoc(vm.$el)
142-
if (vm._isBlock) {
142+
if (vm._isFragment) {
143143
blockOp(vm, target, op, cb)
144144
} else {
145145
op(vm.$el, target, vm, cb)
@@ -151,7 +151,7 @@ function insert (vm, target, cb, withTransition, op1, op2) {
151151
}
152152

153153
/**
154-
* Execute a transition operation on a block instance,
154+
* Execute a transition operation on a fragment instance,
155155
* iterating through all its block nodes.
156156
*
157157
* @param {Vue} vm
@@ -161,8 +161,8 @@ function insert (vm, target, cb, withTransition, op1, op2) {
161161
*/
162162

163163
function blockOp (vm, target, op, cb) {
164-
var current = vm._blockStart
165-
var end = vm._blockEnd
164+
var current = vm._fragmentStart
165+
var end = vm._fragmentEnd
166166
var next
167167
while (next !== end) {
168168
next = current.nextSibling

src/compiler/compile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ exports.compileAndLinkProps = function (vm, el, props) {
146146
* 2. attrs on the component template root node, if
147147
* replace:true (child scope)
148148
*
149-
* If this is a block instance, we only need to compile 1.
149+
* If this is a fragment instance, we only need to compile 1.
150150
*
151151
* This function does compile and link at the same time,
152152
* since root linkers can not be reused. It returns the
@@ -165,7 +165,7 @@ exports.compileAndLinkRoot = function (vm, el, options) {
165165
var contextLinkFn, replacerLinkFn
166166

167167
// only need to compile other attributes for
168-
// non-block instances
168+
// non-fragment instances
169169
if (el.nodeType !== 11) {
170170
// for components, container and replacer need to be
171171
// compiled separately and linked in different scopes.

src/compiler/transclude.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ exports.transclude = function (el, options) {
2424
options._containerAttrs = extractAttrs(el)
2525
}
2626
// for template tags, what we want is its content as
27-
// a documentFragment (for block instances)
27+
// a documentFragment (for fragment instances)
2828
if (_.isTemplate(el)) {
2929
el = templateParser.parse(el)
3030
}
@@ -38,7 +38,7 @@ exports.transclude = function (el, options) {
3838
}
3939
}
4040
if (el instanceof DocumentFragment) {
41-
// anchors for block instance
41+
// anchors for fragment instance
4242
// passing in `persist: true` to avoid them being
4343
// discarded by IE during template cloning
4444
_.prepend(_.createAnchor('v-start', true), el)

src/directives/repeat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ module.exports = {
315315
prevEl = targetPrev
316316
? targetPrev._staggerCb
317317
? targetPrev._staggerAnchor
318-
: targetPrev._blockEnd || targetPrev.$el
318+
: targetPrev._fragmentEnd || targetPrev.$el
319319
: start
320320
if (vm._reused && !vm._staggerCb) {
321321
currentPrev = findPrevVm(vm, start, this.id)

src/instance/compile.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ exports._compile = function (el) {
7676

7777
exports._initElement = function (el) {
7878
if (el instanceof DocumentFragment) {
79-
this._isBlock = true
80-
this.$el = this._blockStart = el.firstChild
81-
this._blockEnd = el.lastChild
79+
this._isFragment = true
80+
this.$el = this._fragmentStart = el.firstChild
81+
this._fragmentEnd = el.lastChild
8282
// set persisted text anchors to empty
83-
if (this._blockStart.nodeType === 3) {
84-
this._blockStart.data = this._blockEnd.data = ''
83+
if (this._fragmentStart.nodeType === 3) {
84+
this._fragmentStart.data = this._fragmentEnd.data = ''
8585
}
8686
this._blockFragment = el
8787
} else {

src/instance/init.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ exports._init = function (options) {
3333
this._eventsCount = {} // for $broadcast optimization
3434
this._eventCancelled = false // for event cancellation
3535

36-
// block instance properties
37-
this._isBlock = false
38-
this._blockStart = // @type {CommentNode}
39-
this._blockEnd = null // @type {CommentNode}
36+
// fragment instance properties
37+
this._isFragment = false
38+
this._fragmentStart = // @type {CommentNode}
39+
this._fragmentEnd = null // @type {CommentNode}
4040

4141
// lifecycle state
4242
this._isCompiled =

src/util/dom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ exports.isTemplate = function (el) {
240240
/**
241241
* Create an "anchor" for performing dom insertion/removals.
242242
* This is used in a number of scenarios:
243-
* - block instance
243+
* - fragment instance
244244
* - v-html
245245
* - v-if
246246
* - component

test/unit/specs/api/dom_spec.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ if (_.inBrowser) {
4141
it('block instance', function () {
4242
vm2.$appendTo(parent, spy)
4343
expect(parent.childNodes.length).toBe(6)
44-
expect(parent.childNodes[2]).toBe(vm2._blockStart)
44+
expect(parent.childNodes[2]).toBe(vm2._fragmentStart)
4545
expect(parent.childNodes[2]).toBe(vm2.$el)
4646
expect(parent.childNodes[3].tagName).toBe('P')
4747
expect(parent.childNodes[4].tagName).toBe('SPAN')
48-
expect(parent.childNodes[5]).toBe(vm2._blockEnd)
48+
expect(parent.childNodes[5]).toBe(vm2._fragmentEnd)
4949
expect(spy.calls.count()).toBe(1)
5050
})
5151

@@ -67,20 +67,20 @@ if (_.inBrowser) {
6767
it('block instance', function () {
6868
vm2.$prependTo(parent, spy)
6969
expect(parent.childNodes.length).toBe(6)
70-
expect(parent.childNodes[0]).toBe(vm2._blockStart)
70+
expect(parent.childNodes[0]).toBe(vm2._fragmentStart)
7171
expect(parent.childNodes[0]).toBe(vm2.$el)
7272
expect(parent.childNodes[1].tagName).toBe('P')
7373
expect(parent.childNodes[2].tagName).toBe('SPAN')
74-
expect(parent.childNodes[3]).toBe(vm2._blockEnd)
74+
expect(parent.childNodes[3]).toBe(vm2._fragmentEnd)
7575
expect(spy.calls.count()).toBe(1)
7676
// empty
7777
vm2.$prependTo(empty, spy)
7878
expect(empty.childNodes.length).toBe(4)
79-
expect(empty.childNodes[0]).toBe(vm2._blockStart)
79+
expect(empty.childNodes[0]).toBe(vm2._fragmentStart)
8080
expect(empty.childNodes[0]).toBe(vm2.$el)
8181
expect(empty.childNodes[1].tagName).toBe('P')
8282
expect(empty.childNodes[2].tagName).toBe('SPAN')
83-
expect(empty.childNodes[3]).toBe(vm2._blockEnd)
83+
expect(empty.childNodes[3]).toBe(vm2._fragmentEnd)
8484
expect(spy.calls.count()).toBe(2)
8585
})
8686

@@ -98,11 +98,11 @@ if (_.inBrowser) {
9898
it('block instance', function () {
9999
vm2.$before(sibling, spy)
100100
expect(parent.childNodes.length).toBe(6)
101-
expect(parent.childNodes[1]).toBe(vm2._blockStart)
101+
expect(parent.childNodes[1]).toBe(vm2._fragmentStart)
102102
expect(parent.childNodes[1]).toBe(vm2.$el)
103103
expect(parent.childNodes[2].tagName).toBe('P')
104104
expect(parent.childNodes[3].tagName).toBe('SPAN')
105-
expect(parent.childNodes[4]).toBe(vm2._blockEnd)
105+
expect(parent.childNodes[4]).toBe(vm2._fragmentEnd)
106106
expect(spy.calls.count()).toBe(1)
107107
})
108108

@@ -127,22 +127,22 @@ if (_.inBrowser) {
127127
it('block instance', function () {
128128
vm2.$after(target, spy)
129129
expect(parent.childNodes.length).toBe(6)
130-
expect(parent.childNodes[1]).toBe(vm2._blockStart)
130+
expect(parent.childNodes[1]).toBe(vm2._fragmentStart)
131131
expect(parent.childNodes[1]).toBe(vm2.$el)
132132
expect(parent.childNodes[2].tagName).toBe('P')
133133
expect(parent.childNodes[3].tagName).toBe('SPAN')
134-
expect(parent.childNodes[4]).toBe(vm2._blockEnd)
134+
expect(parent.childNodes[4]).toBe(vm2._fragmentEnd)
135135
expect(spy.calls.count()).toBe(1)
136136
})
137137

138138
it('block instance no next sibling', function () {
139139
vm2.$after(sibling, spy)
140140
expect(parent.childNodes.length).toBe(6)
141-
expect(parent.childNodes[2]).toBe(vm2._blockStart)
141+
expect(parent.childNodes[2]).toBe(vm2._fragmentStart)
142142
expect(parent.childNodes[2]).toBe(vm2.$el)
143143
expect(parent.childNodes[3].tagName).toBe('P')
144144
expect(parent.childNodes[4].tagName).toBe('SPAN')
145-
expect(parent.childNodes[5]).toBe(vm2._blockEnd)
145+
expect(parent.childNodes[5]).toBe(vm2._fragmentEnd)
146146
expect(spy.calls.count()).toBe(1)
147147
})
148148

@@ -164,11 +164,11 @@ if (_.inBrowser) {
164164
it('block instance', function () {
165165
vm2.$before(sibling)
166166
expect(parent.childNodes.length).toBe(6)
167-
expect(parent.childNodes[1]).toBe(vm2._blockStart)
167+
expect(parent.childNodes[1]).toBe(vm2._fragmentStart)
168168
expect(parent.childNodes[1]).toBe(vm2.$el)
169169
expect(parent.childNodes[2].tagName).toBe('P')
170170
expect(parent.childNodes[3].tagName).toBe('SPAN')
171-
expect(parent.childNodes[4]).toBe(vm2._blockEnd)
171+
expect(parent.childNodes[4]).toBe(vm2._fragmentEnd)
172172
vm2.$remove(spy)
173173
expect(parent.childNodes.length).toBe(2)
174174
expect(parent.childNodes[0]).toBe(target)

test/unit/specs/api/lifecycle_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ if (_.inBrowser) {
112112
expect(vm.$el.nextSibling.textContent).toBe('hi!')
113113
expect(vm.$el.nextSibling.nextSibling.textContent).toBe('hi!!')
114114
expect(document.body.contains(el)).toBe(false)
115-
expect(document.body.lastChild).toBe(vm._blockEnd)
115+
expect(document.body.lastChild).toBe(vm._fragmentEnd)
116116
vm.$remove()
117117
})
118118

test/unit/specs/element-directives/content_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('Content Transclusion', function () {
9595
expect(getChild(3).tagName).toBe('SPAN')
9696

9797
function getChild (n) {
98-
var el = vm._blockStart
98+
var el = vm._fragmentStart
9999
while (n--) {
100100
el = el.nextSibling
101101
}

0 commit comments

Comments
 (0)