Evan You пре 12 година
родитељ
комит
f6ee24a5cf
5 измењених фајлова са 4 додато и 18 уклоњено
  1. 1 1
      src/compiler.js
  2. 0 7
      src/directive.js
  3. 0 5
      src/directives/repeat.js
  4. 0 2
      test/functional/specs/repeated-items.js
  5. 3 3
      test/unit/specs/api.js

+ 1 - 1
src/compiler.js

@@ -435,7 +435,7 @@ CompilerProto.bindDirective = function (directive) {
 
     // for empty or literal directives, simply call its bind()
     // and we're done.
-    if (directive.isEmpty || directive.isLiteral) {
+    if (directive.isEmpty || !directive._update) {
         if (directive.bind) directive.bind()
         return
     }

+ 0 - 7
src/directive.js

@@ -48,13 +48,6 @@ function Directive (definition, expression, rawKey, compiler, node) {
         return
     }
 
-    // for literal directives, all we need
-    // is the expression as the value.
-    if (this.isLiteral) {
-        this.value = expression.trim()
-        return
-    }
-
     this.expression = expression.trim()
     this.rawKey     = rawKey
     

+ 0 - 5
src/directives/repeat.js

@@ -220,11 +220,6 @@ module.exports = {
                     }
                 })
             }
-            // in case `$destroy` is called directly on a repeated vm
-            // make sure the vm's data is properly removed
-            // item.$compiler.observer.on('hook:afterDestroy', function () {
-            //     col.remove(data)
-            // })
         }
     },
 

+ 0 - 2
test/functional/specs/repeated-items.js

@@ -1,5 +1,3 @@
-/* global items */
-
 casper.test.begin('Repeated Items', 41, function (test) {
     
     casper

+ 3 - 3
test/unit/specs/api.js

@@ -142,13 +142,13 @@ describe('UNIT: API', function () {
             assert.notOk(el.getAttribute(testId + 'bind'), 'should have called unbind()')
         })
 
-        it('should create literal directive if given option', function () {
+        it('should not bind directive if no update() is provided', function () {
             var called = false
             Vue.directive('test-literal', {
-                isLiteral: true,
                 bind: function () {
                     called = true
-                    assert.strictEqual(this.value, 'hihi')
+                    assert.strictEqual(this.expression, 'hihi')
+                    assert.notOk(this.binding)
                 }
             })
             new Vue({