소스 검색

config: remove proto option

Evan You 10 년 전
부모
커밋
539b107b79
3개의 변경된 파일3개의 추가작업 그리고 14개의 파일을 삭제
  1. 0 9
      src/config.js
  2. 1 2
      src/observer/index.js
  3. 2 3
      test/unit/specs/observer/observer_spec.js

+ 0 - 9
src/config.js

@@ -17,15 +17,6 @@ module.exports = {
 
   silent: false,
 
-  /**
-   * Whether allow observer to alter data objects'
-   * __proto__.
-   *
-   * @type {Boolean}
-   */
-
-  proto: true,
-
   /**
    * Whether to use async rendering.
    */

+ 1 - 2
src/observer/index.js

@@ -1,5 +1,4 @@
 var _ = require('../util')
-var config = require('../config')
 var Dep = require('./dep')
 var arrayMethods = require('./array')
 var arrayKeys = Object.getOwnPropertyNames(arrayMethods)
@@ -19,7 +18,7 @@ function Observer (value) {
   this.dep = new Dep()
   _.define(value, '__ob__', this)
   if (_.isArray(value)) {
-    var augment = config.proto && _.hasProto
+    var augment = _.hasProto
       ? protoAugment
       : copyAugment
     augment(value, arrayMethods, arrayKeys)

+ 2 - 3
test/unit/specs/observer/observer_spec.js

@@ -1,6 +1,5 @@
 var Observer = require('../../../../src/observer')
 var Dep = require('../../../../src/observer/dep')
-var config = require('../../../../src/config')
 var _ = require('../../../../src/util')
 
 describe('Observer', function () {
@@ -165,7 +164,7 @@ describe('Observer', function () {
   })
 
   it('no proto', function () {
-    config.proto = false
+    _.hasProto = false
     var arr = [1, 2, 3]
     var ob2 = Observer.create(arr)
     expect(arr.$set).toBeTruthy()
@@ -175,7 +174,7 @@ describe('Observer', function () {
     spyOn(dep2, 'notify')
     arr.push(1)
     expect(dep2.notify).toHaveBeenCalled()
-    config.proto = true
+    _.hasProto = true
   })
 
 })