JavaScript: Referencing host function via local variable
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1007340/javascript-function-aliasing-doesnt-seem-to-work">JavaScript function aliasing doesn&#39;t seem to work</a>  </p>
</blockquote>



<p>Why doesn't this work? </p>

<pre><code>function foo() {

    var g = document.getElementById;

    g('sampleID');

} 
</code></pre>

<p>This error is thrown in Chrome: <code>Uncaught TypeError: Illegal invocation</code><br>
... and in Firefox: <code>Error: uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object"</code> </p>

<p>It works in IE9 beta though !!</p>

<p><strong>Demo:</strong> <a href="http://jsfiddle.net/ugBpc/" rel="nofollow">http://jsfiddle.net/ugBpc/</a></p>
