8000 config: remove proto option · codeclever/vue@539b107 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 539b107

Browse files
committed
config: remove proto option
1 parent 2350a01 commit 539b107

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

src/config.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ module.exports = {
1717

1818
silent: false,
1919

20-
/**
21-
* Whether allow observer to alter data objects'
22-
* __proto__.
23-
*
24-
* @type {Boolean}
25-
*/
26-
27-
proto: true,
28-
2920
/**
3021
* Whether to use async rendering.
3122
*/

src/observer/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
var _ = require('../util')
2-
var config = require('../config')
32
var Dep = require('./dep')
43
var arrayMethods = require('./array')
54
var arrayKeys = Object.getOwnPropertyNames(arrayMethods)
@@ -19,7 +18,7 @@ function Observer (value) {
1918
this.dep = new Dep()
2019
_.define(value, '__ob__', this)
2120
if (_.isArray(value)) {
22-
var augment = config.proto && _.hasProto
21+
var augment = _.hasProto
2322
? protoAugment
2423
: copyAugment
2524
augment(value, arrayMethods, arrayKeys)

test/unit/specs/observer/observer_spec.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var Observer = require('../../../../src/observer')
22
var Dep = require('../../../../src/observer/dep')
3-
var config = require('../../../../src/config')
43
var _ = require('../../../../src/util')
54

65
describe('Observer', function () {
@@ -165,7 +164,7 @@ describe('Observer', function () {
165164
})
166165

167166
it('no proto', function () {
168-
config.proto = false
167+
_.hasProto = false
169168
var arr = [1, 2, 3]
170169
var ob2 = Observer.create(arr)
171170
expect(arr.$set).toBeTruthy()
@@ -175,7 +174,7 @@ describe('Observer', function () {
175174
spyOn(dep2, 'notify')
176175
arr.push(1)
177176
expect(dep2.notify).toHaveBeenCalled()
178-
config.proto = true
177+
_.hasProto = true
179178
})
180179

181180
})

0 commit comments

Comments
 (0)
0