Improving Function.prototype.bind

David Bruant bruant.d at
Mon Jan 9 00:29:42 PST 2012

Le 09/01/2012 06:29, Brendan Eich a écrit :
> On Jan 8, 2012, at 7:20 PM, John J Barton wrote:
>> On Sun, Jan 8, 2012 at 3:35 PM, Brendan Eich <brendan at 
>> <mailto:brendan at>> wrote:
>>>     Firebug uses a library bind a lot, and we continually struggled
>>>     with the memoization problem; we did not try to solve it in part
>>>     because we hated Firebug's bind: it made debugging even more
>>>     painful since it messes up the call stack. Using the ES bind()
>>>     ends up not being a win, since I now have exactly the same problems.
>>     I have a question: why is bind used so much in Firebug for event
>>     listeners, when the DOM guarantees to dispatch them with the
>>     event target bound to |this|? Way back in '95, I created event
>>     handlers but did not add bind (it had to be discovered later).
>>     But dynamic |this| binding combined with DOM event target-based
>>     listening and handling kept this properly bound. What has changed?
>> Sorry I don't know what you mean here.
> Why all the this-binding in Firebug if (as you suggested and a grep 
> seems to confirm [but I skimmed]) the methods being this-bound are all 
> or mostly event listeners? The DOM dispatches event handlers on the 
> correct |this|.
Relevant related documentation:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list