Skip to content

Commit c02a5a9

Browse files
committed
remove v-partial
1 parent 3597675 commit c02a5a9

File tree

9 files changed

+12
-226
lines changed

9 files changed

+12
-226
lines changed

component.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"src/directives/model/radio.js",
3939
"src/directives/model/select.js",
4040
"src/directives/on.js",
41-
"src/directives/partial.js",
4241
"src/directives/ref.js",
4342
"src/directives/repeat.js",
4443
"src/directives/show.js",

src/compiler/compile.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ function processTextToken (token, options) {
274274
if (token.html) {
275275
el = document.createComment('v-html')
276276
setTokenType('html')
277-
} else if (token.partial) {
278-
el = document.createComment('v-partial')
279-
setTokenType('partial')
280277
} else {
281278
// IE will clean up empty textNodes during
282279
// frag.cloneNode(true), so we have to give it

src/directives/if.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,19 @@ module.exports = {
3939
// avoid duplicate compiles, since update() can be
4040
// called with different truthy values
4141
if (!this.unlink) {
42-
var frag = templateParser.clone(this.template)
43-
this.compile(frag)
42+
this.compile()
4443
}
4544
} else {
4645
this.teardown()
4746
}
4847
},
4948

50-
// NOTE: this function is shared in v-partial
51-
compile: function (frag) {
49+
compile: function () {
5250
var vm = this.vm
51+
var frag = templateParser.clone(this.template)
5352
// the linker is not guaranteed to be present because
5453
// this function might get called by v-partial
55-
this.unlink = this.linker
56-
? this.linker(vm, frag)
57-
: vm.$compile(frag)
54+
this.unlink = this.linker(vm, frag)
5855
transition.blockAppend(frag, this.end, vm)
5956
// call attached for all the child components created
6057
// during the compilation
@@ -64,7 +61,6 @@ module.exports = {
6461
}
6562
},
6663

67-
// NOTE: this function is shared in v-partial
6864
teardown: function () {
6965
if (!this.unlink) return
7066
// collect children beforehand
@@ -78,7 +74,6 @@ module.exports = {
7874
this.unlink = null
7975
},
8076

81-
// NOTE: this function is shared in v-partial
8277
getContainedComponents: function () {
8378
var vm = this.vm
8479
var start = this.start.nextSibling
@@ -110,7 +105,6 @@ module.exports = {
110105
: transComponents
111106
},
112107

113-
// NOTE: this function is shared in v-partial
114108
unbind: function () {
115109
if (this.unlink) this.unlink()
116110
}

src/directives/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ exports.el = require('./el')
88
exports.ref = require('./ref')
99
exports.cloak = require('./cloak')
1010
exports.style = require('./style')
11-
exports.partial = require('./partial')
1211
exports.transition = require('./transition')
1312

1413
// event listener directives

src/directives/partial.js

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/parsers/text.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ exports.parse = function (text) {
7070
}
7171
var tokens = []
7272
var lastIndex = tagRE.lastIndex = 0
73-
var match, index, value, first, oneTime, partial
73+
var match, index, value, first, oneTime
7474
/* jshint boss:true */
7575
while (match = tagRE.exec(text)) {
7676
index = match.index
@@ -83,16 +83,14 @@ exports.parse = function (text) {
8383
// tag token
8484
first = match[1].charCodeAt(0)
8585
oneTime = first === 0x2A // *
86-
partial = first === 0x3E // >
87-
value = (oneTime || partial)
86+
value = oneTime
8887
? match[1].slice(1)
8988
: match[1]
9089
tokens.push({
9190
tag: true,
9291
value: value.trim(),
9392
html: htmlRE.test(match[0]),
94-
oneTime: oneTime,
95-
partial: partial
93+
oneTime: oneTime
9694
})
9795
lastIndex = index + match[0].length
9896
}

test/unit/specs/compiler/compile_spec.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,27 +89,20 @@ if (_.inBrowser) {
8989
expect(el.innerHTML).toBe(' and yeah')
9090
})
9191

92-
it('inline html and partial', function () {
93-
data.html = 'yoyoyo'
94-
el.innerHTML = '{{{html}}} {{{*html}}} {{>partial}}'
92+
it('inline html', function () {
93+
data.html = '<div>yoyoyo</div>'
94+
el.innerHTML = '{{{html}}} {{{*html}}}'
9595
var htmlDef = Vue.options.directives.html
96-
var partialDef = Vue.options.directives.partial
9796
var htmlDesc = dirParser.parse('html')[0]
98-
var partialDesc = dirParser.parse('partial')[0]
9997
var linker = compile(el, Vue.options)
10098
linker(vm, el)
101-
expect(vm._bindDir.calls.count()).toBe(2)
99+
expect(vm._bindDir.calls.count()).toBe(1)
102100
var htmlArgs = vm._bindDir.calls.argsFor(0)
103101
expect(htmlArgs[0]).toBe('html')
104102
expect(htmlArgs[2]).toBe(htmlDesc)
105103
expect(htmlArgs[3]).toBe(htmlDef)
106-
var partialArgs = vm._bindDir.calls.argsFor(1)
107-
expect(partialArgs[0]).toBe('partial')
108-
expect(partialArgs[2]).toBe(partialDesc)
109-
expect(partialArgs[3]).toBe(partialDef)
110-
expect(vm.$eval).toHaveBeenCalledWith('html')
111104
// with placeholder comments & interpolated one-time html
112-
expect(el.innerHTML).toBe('<!--v-html--> yoyoyo <!--v-partial-->')
105+
expect(el.innerHTML).toBe('<!--v-html--> <div>yoyoyo</div>')
113106
})
114107

115108
it('terminal directives', function () {

test/unit/specs/directives/partial_spec.js

Lines changed: 0 additions & 135 deletions
This file was deleted.

test/unit/specs/parsers/text_spec.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,6 @@ var testCases = [
3535
{ tag: true, value: 'html', html: true, oneTime: true },
3636
]
3737
},
38-
{
39-
// partial
40-
text: '{{> hello }} and {{>hello}}',
41-
expected: [
42-
{ tag: true, value: 'hello', html: false, oneTime: false, partial: true },
43-
{ value: ' and ' },
44-
{ tag: true, value: 'hello', html: false, oneTime: false, partial: true }
45-
]
46-
},
4738
{
4839
text: '[{{abc}}]',
4940
expected: [

0 commit comments

Comments
 (0)