Evan You 10 ani în urmă
părinte
comite
f66ef7db75
2 a modificat fișierele cu 9 adăugiri și 15 ștergeri
  1. 7 8
      src/directive.js
  2. 2 7
      src/instance/lifecycle.js

+ 7 - 8
src/directive.js

@@ -26,18 +26,17 @@ var expParser = require('./parsers/expression')
 
 // TODO: 1.0.0 cleanup the arguments
 
-function Directive (name, el, vm, descriptor, def, host, scope, frag, arg, literal) {
-  // public
-  this.name = name
-  this.el = el
+function Directive (descriptor, vm, el, host, scope, frag) {
   this.vm = vm
-  // copy descriptor props
+  this.el = el
+  // copy descriptor properties
   this.descriptor = descriptor
+  this.name = descriptor.name
   this.expression = descriptor.expression
-  this.arg = arg || descriptor.arg
+  this.arg = descriptor.arg
   this.filters = descriptor.filters
   // private
-  this._def = def
+  this._def = descriptor.def
   this._locked = false
   this._bound = false
   this._listeners = null
@@ -46,7 +45,7 @@ function Directive (name, el, vm, descriptor, def, host, scope, frag, arg, liter
   this._scope = scope
   this._frag = frag
   // 1.0.0 literal
-  this._literal = literal
+  this._literal = descriptor.literal
 }
 
 /**

+ 2 - 7
src/instance/lifecycle.js

@@ -103,14 +103,9 @@ exports._initElement = function (el) {
  * @param {Fragment} [frag] - owner fragment
  */
 
-exports._bindDir = function (dir, node, host, scope, frag) {
-  var desc = {
-    expression: dir.expression,
-    filters: dir.filters,
-    prop: dir.prop
-  }
+exports._bindDir = function (descriptor, node, host, scope, frag) {
   this._directives.push(
-    new Directive(dir.name, node, this, desc, dir.def, host, scope, frag, dir.arg, dir.literal)
+    new Directive(descriptor, this, node, host, scope, frag)
   )
 }