So I\'m trying to define a function g() that is like document.getElementById. The following works just fine:
var g = function(id){return document.getElementB
Because when you call "g('somestr')" the "this" value is bound to the "window" and "document.getElementById" seens to expect to be bound to "document" instead "window"(makes sense to me =) ). Doing:
var g = document.getElementById;
g('somestr');
is like:
document.getElementById.call(window, 'somestr');