After coming across this specific question, I decided to experiment with the alias method rather than using the function-wrapper method. Unfortunately, I faced issues getting it to function properly in both Firefox 3 and 3.5beta4, as well as in Google Chrome. This problem occurred when testing in their respective debug windows and on a sample web page.
Here's what Firebug displayed:
>>> window.myAlias = document.getElementById
function()
>>> myAlias('item1')
>>> window.myAlias('item1')
>>> document.getElementById('item1')
<div id="item1">
When used on a web page, calling myAlias triggered an error message:
uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS frame :: file:///[...snip...]/test.html :: <TOP_LEVEL> :: line 7" data: no]
The scenario in Chrome, with added >>> for clarity, was as follows:
>>> window.myAlias = document.getElementById
function getElementById() { [native code] }
>>> window.myAlias('item1')
TypeError: Illegal invocation
>>> document.getElementById('item1')
<div id=?"item1">?
Even on the test page, the same "Illegal invocation" issue persisted.
I questioned whether I made a mistake. Has anyone else encountered this problem?
In a surprising turn of events, I found that it actually worked in IE8.