8000 Remove convertAllProperties config value with new behaviour as if it … · ctyu/vue@98f06e1 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 98f06e1

Browse files
committed
Remove convertAllProperties config value with new behaviour as if it was true.
1 parent 2d658a6 commit 98f06e1

File tree

4 files changed

+2
-49
lines changed

4 files changed

+2
-49
lines changed

src/config.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ const config = {
3535

3636
warnExpressionErrors: true,
3737

38-
/**
39-
* Whether or not to handle fully object properties which
40-
* are already backed by getters and seters. Depending on
41-
* use case and environment, this might introduce non-neglible
42-
* performance penalties.
43-
*/
44-
convertAllProperties: false,
45-
4638
/**
4739
* Internal flag to indicate the delimiters have been
4840
* changed.

src/observer/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import config from '../config'
21
import Dep from './dep'
32
import { arrayMethods } from './array'
43
import {
@@ -183,11 +182,8 @@ export function defineReactive (obj, key, val) {
183182
}
184183

185184
// cater for pre-defined getter/setters
186-
var getter, setter
187-
if (config.convertAllProperties) {
188-
getter = property && property.get
189-
setter = property && property.set
190-
}
185+
var getter = property && property.get
186+
var setter = property && property.set
191187

192188
var childOb = observe(val)
193189
Object.defineProperty(obj, key, {

test/unit/specs/directives/public/for/for_spec.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
var _ = require('src/util')
22
var Vue = require('src')
3-
var config = require('src/config')
43

54
describe('v-for', function () {
65
var el
76
beforeEach(function () {
87
el = document.createElement('div')
98
spyWarns()
10-
config.convertAllProperties = false
119
})
1210

1311
it('objects', function (done) {
@@ -21,18 +19,6 @@ describe('v-for', function () {
2119
assertMutations(vm, el, done)
2220
})
2321

24-
it('objects with convertAllProperties on', function (done) {
25-
config.convertAllProperties = true
26-
var vm = new Vue({
27-
el: el,
28-
data: {
29-
items: [{a: 1}, {a: 2}]
30-
},
31-
template: '<div v-for="item in items">{{$index}} {{item.a}}</div>'
32-
})
33-
assertMutations(vm, el, done)
34-
})
35-
3622
it('primitives', function (done) {
3723
var vm = new Vue({
3824
el: el,

test/unit/specs/observer/observer_spec.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ var Observer = ob.Observer
44
var observe = ob.observe
55
var Dep = require('src/observer/dep')
66
var _ = require('src/util')
7-
var config = require('src/config')
87

98
describe('Observer', function () {
109
beforeEach(function () {
@@ -59,9 +58,6 @@ describe('Observer', function () {
5958
})
6059

6160
it('create on already observed object', function () {
62-
var previousConvertAllProperties = config.convertAllProperties
63-
config.convertAllProperties = true
64-
6561
// on object
6662
var obj = {}
6763
var val = 0
@@ -97,14 +93,9 @@ describe('Observer', function () {
9793
// should call underlying setter
9894
obj.a = 10
9995
expect(val).toBe(10)
100-
101-
config.convertAllProperties = previousConvertAllProperties
10296
})
10397

10498
it('create on property with only getter', function () {
105-
var previousConvertAllProperties = config.convertAllProperties
106-
config.convertAllProperties = true
107-
10899
// on object
109100
var obj = {}
110101
Object.defineProperty(obj, 'a', {
@@ -134,14 +125,9 @@ describe('Observer', function () {
134125
obj.a = 101
135126
} catch (e) {}
136127
expect(obj.a).toBe(123)
137-
138-
config.convertAllProperties = previousConvertAllProperties
139128
})
140129

141130
it('create on property with only setter', function () {
142-
var previousConvertAllProperties = config.convertAllProperties
143-
config.convertAllProperties = true
144-
145131
// on object
146132
var obj = {}
147133
var val = 10
@@ -168,8 +154,6 @@ describe('Observer', function () {
168154
// writes should call the set function
169155
obj.a = 100
170156
expect(val).toBe(100)
171-
172-
config.convertAllProperties = previousConvertAllProperties
173157
})
174158

175159
it('create on property which is marked not configurable', function () {
@@ -232,9 +216,6 @@ describe('Observer', function () {
232216
})
233217

234218
it('observing object prop change on defined property', function () {
235-
var previousConvertAllProperties = config.convertAllProperties
236-
config.convertAllProperties = true
237-
238219
var obj = { val: 2 }
239220
Object.defineProperty(obj, 'a', {
240221
configurable: true,
@@ -266,8 +247,6 @@ describe('Observer', function () {
266247
expect(obj.val).toBe(3) // make sure 'setter' was called
267248
obj.val = 5
268249
expect(obj.a).toBe(5) // make sure 'getter' was called
269-
270-
config.convertAllProperties = previousConvertAllProperties
271250
})
272251

273252
it('observing set/delete', function () {

0 commit comments

Comments
 (0)
0