Shopify/batman — pull request #630 by kristianpd (2013-01-03 03:43:16+00:00)
Title: Defer function binding until bind

After a lot of back and forth and too many hours of chrome profiling, I believe this indirectly "fixes" the detached DOM issue on some of our bindings.

I don't believe this to necessarily be the root cause of the problem as I don't see what it could be changing that would fix this. It seems as though having it instance bound, or having any bound function (along the lines of `@_foo = @_fireNodeChange.bind(this)`) in the binding will leak the DOM. I'm trying to figure out the root cause here, it may be another race condition on iterator bindings or it may be a bigger problem.

It's possible that in deferring the binding of the function until `bind` is actually called, a reference isn't being kept around that would otherwise normally be created up front. That said, I feel like this should simply be a circular reference and that when the binding is cleaned up it should be dropped. I tried to track down if bindings were being kept around but wasn't able to find any in my focused test

This isn't a complete PR, just an WIP of my findings so far and opening it up for discussion.

@hornairs @nciagra any thoughts on this?