Skip to content

Commit

Permalink
Remove convertAllProperties config value with new behaviour as if it …
Browse files Browse the repository at this point in the history
…was true.
  • Loading branch information
saul committed Feb 27, 2016
1 parent 2d658a6 commit 98f06e1
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 49 deletions.
8 changes: 0 additions & 8 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 2 additions & 6 deletions src/observer/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import config from '../config'
import Dep from './dep'
import { arrayMethods } from './array'
import {
Expand Down Expand Up @@ -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, {
Expand Down
14 changes: 0 additions & 14 deletions test/unit/specs/directives/public/for/for_spec.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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,
Expand Down
21 changes: 0 additions & 21 deletions test/unit/specs/observer/observer_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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', {
Expand Down Expand Up @@ -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
Expand All @@ -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 () {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 () {
Expand Down

0 comments on commit 98f06e1

Please sign in to comment.