import { util } from 'vue';

export var directive = {

  acceptStatement: true,
  priority: 700,

  update: function(handler) {
    if (typeof handler !== 'function') {
      if (process.env.NODE_ENV !== 'production') {
        util.warn(
          this.name + '="' +
          this.expression + '" expects a function value, ' +
          'got ' + handler
        );
      }
      return;
    }

    this.reset();

    var self = this;
    var scope = this._scope || this.vm;

    this.handler = function(ev) {
      // @NOTE: IE 5.0+
      // @REFERENCE: https://developer.mozilla.org/en/docs/Web/API/Node/contains
      if (!self.el.contains(ev.target)) {
        scope.$event = ev;
        var res = handler(ev);
        scope.$event = null;
        return res;
      }
    };

    util.on(document.documentElement, 'click', this.handler);
  },

  reset: function() {
    util.off(document.documentElement, 'click', this.handler);
  },

  unbind: function() {
    this.reset();
  },

};

export var mixin = {
  directives: { onClickaway: directive },
};

@@ -420,19 +420,20 @@
 var 
-s
 el
-f
  = this
+.el
 ;%0A  
@@ -625,13 +625,8 @@
 f (!
-self.
 el.c

Use the el reference instead of the vm reference