Evan You пре 10 година
родитељ
комит
abb0a4520d
4 измењених фајлова са 10 додато и 13 уклоњено
  1. 0 1
      src/directive.js
  2. 1 1
      src/directives/internal/attr.js
  3. 9 9
      src/directives/internal/on.js
  4. 0 2
      src/directives/public/for.js

+ 0 - 1
src/directive.js

@@ -30,7 +30,6 @@ function Directive (descriptor, vm, el, host, scope, frag) {
   this.descriptor = descriptor
   this.name = descriptor.name
   this.expression = descriptor.expression
-  this.arg = descriptor.arg
   this.filters = descriptor.filters
   this.literal = descriptor.literal
   // private

+ 1 - 1
src/directives/internal/attr.js

@@ -23,7 +23,7 @@ module.exports = {
   priority: 850,
 
   update: function (value) {
-    var attr = this.arg
+    var attr = this.descriptor.arg
     if (inputProps[attr] && attr in this.el) {
       if (!this.valueRemoved) {
         this.el.removeAttribute(attr)

+ 9 - 9
src/directives/internal/on.js

@@ -40,21 +40,21 @@ module.exports = {
 
   bind: function () {
     // 1.0.0 key filter
-    var rawArg = this.arg
-    var keyIndex = rawArg.indexOf(':')
+    var rawEvent = this.event = this.descriptor.arg
+    var keyIndex = rawEvent.indexOf(':')
     if (keyIndex > -1) {
-      this.arg = rawArg.slice(0, keyIndex)
-      this.key = rawArg.slice(keyIndex + 1)
+      this.event = rawEvent.slice(0, keyIndex)
+      this.key = rawEvent.slice(keyIndex + 1)
     }
 
     // deal with iframes
     if (
       this.el.tagName === 'IFRAME' &&
-      this.arg !== 'load'
+      this.event !== 'load'
     ) {
       var self = this
       this.iframeBind = function () {
-        _.on(self.el.contentWindow, self.arg, self.handler)
+        _.on(self.el.contentWindow, self.event, self.handler)
       }
       this.on('load', this.iframeBind)
     }
@@ -63,7 +63,7 @@ module.exports = {
   update: function (handler) {
     if (typeof handler !== 'function') {
       process.env.NODE_ENV !== 'production' && _.warn(
-        'on-"' + this.arg + '="' +
+        'on-"' + this.event + '="' +
         this.expression + '" expects a function value, ' +
         'got ' + handler
       )
@@ -85,7 +85,7 @@ module.exports = {
     if (this.iframeBind) {
       this.iframeBind()
     } else {
-      _.on(this.el, this.arg, this.handler)
+      _.on(this.el, this.event, this.handler)
     }
   },
 
@@ -94,7 +94,7 @@ module.exports = {
       ? this.el.contentWindow
       : this.el
     if (this.handler) {
-      _.off(el, this.arg, this.handler)
+      _.off(el, this.event, this.handler)
     }
   },
 

+ 0 - 2
src/directives/public/for.js

@@ -8,8 +8,6 @@ module.exports = {
   priority: 2000,
 
   bind: function () {
-    // determine alias
-    this.alias = this.arg
     // support "item in items" syntax
     var inMatch = this.expression.match(/(.*) in (.*)/)
     if (inMatch) {