Skip to content

Instantly share code, notes, and snippets.

@4nduril
Created February 22, 2016 14:39
Show Gist options
  • Save 4nduril/dab571e876b215e3786f to your computer and use it in GitHub Desktop.
Save 4nduril/dab571e876b215e3786f to your computer and use it in GitHub Desktop.
Backbone View not redelegating events
var sampleView = Backbone.View.extend({
events: {
"click": "myClickHandler"
},
render: {
// the following constructor creates an element with the class ".test" and adds it to the DOM
var newElemInstance = new externalModuleConstructor();
this.setElement(document.querySelector(".test"));
}
});
var view = new SampleView();
// view.$el --> <div class="test">
// click on <div class="test"> doesn't call myClickHandler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment