backbone.keys icon indicating copy to clipboard operation
backbone.keys copied to clipboard

Check if delegateKeys is set before calling it

Open timlind opened this issue 11 years ago • 5 comments

Marionette CollectionView calls Backbone.View.prototype.delegateEvents.call directly, on instances that don't necessarily have delegateKeys set because they referenced Backbone before the backbone.keys library was loaded (using require).

Introduce a check:

if (typeof this.delegateKeys === 'function') { this.delegateKeys(); }

Or implement as a mixin instead of overriding Backbone.View

timlind avatar Mar 12 '13 11:03 timlind

I've tried to trigger this issue in the marionette-compliance branch, but for me it seems to work. Could you provide some code making it break?

nervetattoo avatar Mar 17 '13 12:03 nervetattoo

I also have this issue, but only when using it with the requirejs optimizer. But also with Marionette.

patrick-radius avatar Mar 18 '14 09:03 patrick-radius

Can you provide a minimal example to reproduce the error?

nervetattoo avatar Mar 19 '14 08:03 nervetattoo

I wish i could, but i'm not sure how to set it up. Like i said it only happens when combining/compiling with the requirejs optimiser in my case. So just creating a standalone example doesn't really show it i guess.

patrick-radius avatar Mar 27 '14 16:03 patrick-radius

You must refrence backbone.keys above martionette.

MillerRen avatar Nov 24 '14 08:11 MillerRen