ivaynberg/select2 — pull request #2313 by FallSe7en (2014-04-24 00:48:18+00:00)
Title: Cleanup jQuery DOM elements on destroy

Hi,

I noticed that select2-created DOM elements were being left in detached DOM trees in the heap after select2 is destroyed. This fix cleans them up.

One thing to note--the closure in the thunk function was holding a reference that disallowed some of the DOM elements from being GC'd so I removed the entire function. I ran some performance tests using JSLitmus and didn't notice any speed degradation, but just thought I'd point that out.

Also, I removed the extra reference to the mutationHandler because the associated bug in the Chromium project has been fixed. The mutationHandler was also holding some references that prevented things from being GC'd.

Let me know if there are any questions!

Thanks,
Justin