mirror of https://github.com/vuejs/vue.git
Remove convertAllProperties config value with new behaviour as if it was true.
This commit is contained in:
parent
2d658a6fca
commit
98f06e11d5
|
|
@ -35,14 +35,6 @@ const config = {
|
|||
|
||||
warnExpressionErrors: true,
|
||||
|
||||
/**
|
||||
* Whether or not to handle fully object properties which
|
||||
* are already backed by getters and seters. Depending on
|
||||
* use case and environment, this might introduce non-neglible
|
||||
* performance penalties.
|
||||
*/
|
||||
convertAllProperties: false,
|
||||
|
||||
/**
|
||||
* Internal flag to indicate the delimiters have been
|
||||
* changed.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import config from '../config'
|
||||
import Dep from './dep'
|
||||
import { arrayMethods } from './array'
|
||||
import {
|
||||
|
|
@ -183,11 +182,8 @@ export function defineReactive (obj, key, val) {
|
|||
}
|
||||
|
||||
// cater for pre-defined getter/setters
|
||||
var getter, setter
|
||||
if (config.convertAllProperties) {
|
||||
getter = property && property.get
|
||||
setter = property && property.set
|
||||
}
|
||||
var getter = property && property.get
|
||||
var setter = property && property.set
|
||||
|
||||
var childOb = observe(val)
|
||||
Object.defineProperty(obj, key, {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
var _ = require('src/util')
|
||||
var Vue = require('src')
|
||||
var config = require('src/config')
|
||||
|
||||
describe('v-for', function () {
|
||||
var el
|
||||
beforeEach(function () {
|
||||
el = document.createElement('div')
|
||||
spyWarns()
|
||||
config.convertAllProperties = false
|
||||
})
|
||||
|
||||
it('objects', function (done) {
|
||||
|
|
@ -21,18 +19,6 @@ describe('v-for', function () {
|
|||
assertMutations(vm, el, done)
|
||||
})
|
||||
|
||||
it('objects with convertAllProperties on', function (done) {
|
||||
config.convertAllProperties = true
|
||||
var vm = new Vue({
|
||||
el: el,
|
||||
data: {
|
||||
items: [{a: 1}, {a: 2}]
|
||||
},
|
||||
template: '<div v-for="item in items">{{$index}} {{item.a}}</div>'
|
||||
})
|
||||
assertMutations(vm, el, done)
|
||||
})
|
||||
|
||||
it('primitives', function (done) {
|
||||
var vm = new Vue({
|
||||
el: el,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ var Observer = ob.Observer
|
|||
var observe = ob.observe
|
||||
var Dep = require('src/observer/dep')
|
||||
var _ = require('src/util')
|
||||
var config = require('src/config')
|
||||
|
||||
describe('Observer', function () {
|
||||
beforeEach(function () {
|
||||
|
|
@ -59,9 +58,6 @@ describe('Observer', function () {
|
|||
})
|
||||
|
||||
it('create on already observed object', function () {
|
||||
var previousConvertAllProperties = config.convertAllProperties
|
||||
config.convertAllProperties = true
|
||||
|
||||
// on object
|
||||
var obj = {}
|
||||
var val = 0
|
||||
|
|
@ -97,14 +93,9 @@ describe('Observer', function () {
|
|||
// should call underlying setter
|
||||
obj.a = 10
|
||||
expect(val).toBe(10)
|
||||
|
||||
config.convertAllProperties = previousConvertAllProperties
|
||||
})
|
||||
|
||||
it('create on property with only getter', function () {
|
||||
var previousConvertAllProperties = config.convertAllProperties
|
||||
config.convertAllProperties = true
|
||||
|
||||
// on object
|
||||
var obj = {}
|
||||
Object.defineProperty(obj, 'a', {
|
||||
|
|
@ -134,14 +125,9 @@ describe('Observer', function () {
|
|||
obj.a = 101
|
||||
} catch (e) {}
|
||||
expect(obj.a).toBe(123)
|
||||
|
||||
config.convertAllProperties = previousConvertAllProperties
|
||||
})
|
||||
|
||||
it('create on property with only setter', function () {
|
||||
var previousConvertAllProperties = config.convertAllProperties
|
||||
config.convertAllProperties = true
|
||||
|
||||
// on object
|
||||
var obj = {}
|
||||
var val = 10
|
||||
|
|
@ -168,8 +154,6 @@ describe('Observer', function () {
|
|||
// writes should call the set function
|
||||
obj.a = 100
|
||||
expect(val).toBe(100)
|
||||
|
||||
config.convertAllProperties = previousConvertAllProperties
|
||||
})
|
||||
|
||||
it('create on property which is marked not configurable', function () {
|
||||
|
|
@ -232,9 +216,6 @@ describe('Observer', function () {
|
|||
})
|
||||
|
||||
it('observing object prop change on defined property', function () {
|
||||
var previousConvertAllProperties = config.convertAllProperties
|
||||
config.convertAllProperties = true
|
||||
|
||||
var obj = { val: 2 }
|
||||
Object.defineProperty(obj, 'a', {
|
||||
configurable: true,
|
||||
|
|
@ -266,8 +247,6 @@ describe('Observer', function () {
|
|||
expect(obj.val).toBe(3) // make sure 'setter' was called
|
||||
obj.val = 5
|
||||
expect(obj.a).toBe(5) // make sure 'getter' was called
|
||||
|
||||
config.convertAllProperties = previousConvertAllProperties
|
||||
})
|
||||
|
||||
it('observing set/delete', function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue