[Webkit-unassigned] [Bug 20141] Cannot call pointer to function console.log

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Apr 12 06:30:44 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=20141





--- Comment #24 from kangax <kangax at gmail.com>  2013-04-12 06:28:58 PST ---
(In reply to comment #19)
> This shouldn't work.  Comment #7 is solved simply by using bind(); calling a bound console function does work as expected (it may not have back in 2010, but it does today).
> 
> You can't pull random member functions off of objects and have it work.  You can't say "g = document.getElementById; g('foo')".  That's what bind() is for.
> 
> This might make a little sense if console.log acted like a static function (eg. if it didn't actually care about the console object), but it doesn't; which console.log you call determines which console it goes to.  Please don't add new weird things to the web.

I don't see anything new and weird about `log` being bound to its console. Host objects returning "unknown" typeof in IE and blowing up on simple property access — that was weird. And even that was allowed by the spec.

The binding is not a deal breaker but it's certainly a slight inconvenience to bind it manually in cases when it's not called as a method of console (e.g. `someArray.forEach(console.log)`).

And if it is bound, which problems does it cause? Maybe I'm missing something?

FWIW, both Firefox and Opera make it bound. IE10 doesn't. So that makes it 2-vs-2, and — once Opera switches to webkit — 3-vs-1.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list