title: JavaScript - my own document method
body: <p>I wrote an own document method and it works. Consider the use of it like this:</p>
  
  <pre><code>document.myMethod();
  </code></pre>
  
  <p>How can I dynamically find out what dot notations were used before myMethod?</p>
  
  <pre><code>document.getElementsByTagName('div')[0].myMethod();
  </code></pre>
  
  <p>I tried <code>this</code> but it does not work. Any ideas?</p>
  
  <p>Update: I'm making my own <code>getElementsByClass('class')</code>. So I have to know what elements should be checked. <code>document.myMethod()</code> should check all of the elements but <code>document.getElementById('id').myMethod()</code> only the childs of #id. How do I do that?</p>