title: Unable to trigger click function in own custom plugin
body: <p>I am trying to write  own custom plain Javascript plugin. </p>
  
  <p>Here is my sample plugin code:</p>
  
  <pre><code>(function() {
      var pMethods = {
          append: function(text) {
              var node = this.node;
              node.innerHTML += text;
          },
          click: function(fn) {
              if (this.node instanceof Array) {
                  this.node.forEach(function(e) {
                      e.addEventListener('click', function() {
                          fn();
                      });
                  }, this);
              } else {
                  this.node.addEventListener('click', function(e) {
                      fn(e);
                  });
              }
          }
      };
      myPlugin = function(selector) {
          this.node = document.querySelectorAll(selector);
          if (this.node.length === 1) {
              this.node = this.node[0];
          }
          return this.node;
      };
      myPlugin.prototype = pMethods;
  
      this.r = function(selector) {
          return new myPlugin(selector);
      };
  }());
  </code></pre>
  
  <p>which has just two function append and click. </p>
  
  <p>Here is my HTML:</p>
  
  <pre><code> &lt;div class="close"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Now I am trying to add click event on close div as follow:</p>
  
  <pre><code>r('.close').click(function() {
      alert('Hi')
  });
  </code></pre>
  
  <p>but it is not working as expected and I don't know what I'm missing here.</p>