Reputation: 2371
From Chrome 17 on, arguments.callee.caller seems to be null for bound functions:
function a() {
this.test = function() { console.debug('*** ' + arguments.callee.caller); };
this.test(); // This prints the function
this.bound = this.test.bind(this);
this.bound(); // This prints null
}
The bound and unbound functions used to act consistently, but not anymore.
Is this expected behavior?
Upvotes: 1
Views: 1303
Reputation: 76736
arguments.callee
and company are deprecated. They throw errors in strict mode. My guess is that they are being phased out in newer versions of Chrome. I can't confirm, though, because I'm still on 16.
Upvotes: 1
Reputation: 91
Maybe it's not an error. You may note this:
If the function f was invoked by the top level code, the value of f.caller is null, otherwise it's the function that called f.
MDN
And when you use this in function a, 'this'
means DOMWindow
. so When you bind bound function to this
, bound function was invoked by the top level code. It returns null
.
May it helps. rdtriny.
Upvotes: 2