I am having some trouble getting the text of elements using querySelectorAll. I already tried using querySelector but it only gives me the value of the first element. What I want to achieve is to get the text of the clicked element. Here's my code:  
function __(selector){
   var self = {};
   self.selector = selector;
   if(typeof selector == 'undefined'){
      self.element = [self.selector];
   }else{
      self.element = document.querySelectorAll(self.selector);
   }
   // creating a method (.on)
    self.on = function(type, callback){
        self.element.forEach(function(elements){
           elements['on' + type] = callback;
        });
    }
     self.text = function(elems){
          [].slice.call(self.element).forEach(function(el,i){
                return el.innerHTML;
           });
     }
     return self;
}
And the HTML File:
<script src="selector.js"></script>
<script>
   window.onload = function(){
        __('p').on('click', function(){
               alert(__(this).text());
        });
   }
</script>
<p>Hello</p>  
<p>World</p>
The code above gives me an undefined value.
 
     
    