Sfoglia il codice sorgente

remove strict mode

Evan You 10 anni fa
parent
commit
204e20f096

+ 0 - 7
src/config.js

@@ -17,13 +17,6 @@ module.exports = {
 
 
   debug: false,
   debug: false,
 
 
-  /**
-   * Strict mode.
-   * Disables asset lookup in the view parent chain.
-   */
-
-  strict: false,
-
   /**
   /**
    * Whether to suppress warnings.
    * Whether to suppress warnings.
    *
    *

+ 4 - 0
src/fragment/fragment.js

@@ -55,6 +55,10 @@ Fragment.prototype.callHook = function (hook) {
   }
   }
 }
 }
 
 
+/**
+ * Destroy the fragment.
+ */
+
 Fragment.prototype.destroy = function () {
 Fragment.prototype.destroy = function () {
   if (this.parentFrag) {
   if (this.parentFrag) {
     this.parentFrag.childFrags.$remove(this)
     this.parentFrag.childFrags.$remove(this)

+ 1 - 22
src/util/options.js

@@ -350,26 +350,5 @@ exports.resolveAsset = function resolve (options, type, id) {
   var camelizedId = _.camelize(id)
   var camelizedId = _.camelize(id)
   var pascalizedId = camelizedId.charAt(0).toUpperCase() + camelizedId.slice(1)
   var pascalizedId = camelizedId.charAt(0).toUpperCase() + camelizedId.slice(1)
   var assets = options[type]
   var assets = options[type]
-  var asset = assets[id] || assets[camelizedId] || assets[pascalizedId]
-
-  // for deprecation check
-  var localAsset = asset
-
-  while (
-    !asset &&
-    options._parent &&
-    (!config.strict || options._repeat)
-  ) {
-    options = (options._context || options._parent).$options
-    assets = options[type]
-    asset = assets[id] || assets[camelizedId] || assets[pascalizedId]
-  }
-
-  if (process.env.NODE_ENV !== 'production') {
-    if (asset && !localAsset && !config.strict) {
-      _.deprecation.STRICT_MODE(type, id)
-    }
-  }
-
-  return asset
+  return assets[id] || assets[camelizedId] || assets[pascalizedId]
 }
 }

+ 0 - 1
test/unit/specs/api/child_spec.js

@@ -23,7 +23,6 @@ describe('Child API', function () {
     expect(child.$parent).toBe(vm)
     expect(child.$parent).toBe(vm)
     expect(child.$root).toBe(vm)
     expect(child.$root).toBe(vm)
     expect(vm.$children.indexOf(child)).toBe(0)
     expect(vm.$children.indexOf(child)).toBe(0)
-    expect(_.resolveAsset(child.$options, 'directives', 'test')).toBeTruthy()
   })
   })
 
 
   it('inherit scope', function () {
   it('inherit scope', function () {

+ 11 - 7
test/unit/specs/directives/if_spec.js

@@ -208,6 +208,12 @@ if (_.inBrowser) {
       document.body.appendChild(el)
       document.body.appendChild(el)
       var attachSpy = jasmine.createSpy('attached')
       var attachSpy = jasmine.createSpy('attached')
       var detachSpy = jasmine.createSpy('detached')
       var detachSpy = jasmine.createSpy('detached')
+      var transcluded = {
+        props: ['a'],
+        template: '{{a}}',
+        attached: attachSpy,
+        detached: detachSpy
+      }
       var vm = new Vue({
       var vm = new Vue({
         el: el,
         el: el,
         data: {
         data: {
@@ -228,14 +234,12 @@ if (_.inBrowser) {
               '</div>' +
               '</div>' +
               // this is to test that compnents that are not in the if block
               // this is to test that compnents that are not in the if block
               // should not fire attach/detach when v-if toggles
               // should not fire attach/detach when v-if toggles
-              '<transcluded></transcluded>'
+              '<transcluded></transcluded>',
+            components: {
+              transcluded: transcluded
+            }
           },
           },
-          transcluded: {
-            props: ['a'],
-            template: '{{a}}',
-            attached: attachSpy,
-            detached: detachSpy
-          }
+          transcluded: transcluded
         }
         }
       })
       })
       assertMarkup()
       assertMarkup()

+ 0 - 18
test/unit/specs/misc_spec.js

@@ -229,24 +229,6 @@ describe('Misc', function () {
     })
     })
   })
   })
 
 
-  it('strict mode', function () {
-    Vue.config.strict = true
-    new Vue({
-      el: document.createElement('div'),
-      template: '<test></test>',
-      components: {
-        test: {
-          template: '<div v-strict>hi</div>'
-        }
-      },
-      directives: {
-        strict: function () {}
-      }
-    })
-    expect(hasWarned(_, 'Failed to resolve directive: strict')).toBe(true)
-    Vue.config.strict = false
-  })
-
   it('class interpolation and v-class should work together', function (done) {
   it('class interpolation and v-class should work together', function (done) {
     var el = document.createElement('div')
     var el = document.createElement('div')
     el.setAttribute('class', 'a {{classB}}')
     el.setAttribute('class', 'a {{classB}}')