documentcloud/backbone — Issue #986: Double event firing if the new el if sub-element of the old
Author: ivasilov
Created: 2012-02-10 18:02:34+00:00
State: open

I ran into a problem while redefining "el" into a view. The problem is if we have an event (on a button for example) in a scoped DOM element, and then we redefine "el" (where the new "el" is a sub-element of the old one and contains the button in question) via setElement, the event will fire twice on a click of a button.

This bug doesn't happen if I insert ```this.undelegateEvents()``` before redefining "el".