balderdashy / mast

UI conventions built on top of Backbone.JS
MIT License
81 stars 14 forks source link

Bound Model Collection Hooks Wrong Context #126

Closed particlebanana closed 10 years ago

particlebanana commented 11 years ago

The Bound Model Collection Hooks described here: https://github.com/balderdashy/mast/wiki/Bound-Model-Collection-Hooks get called in the window context so you don't have access to view with this.el.

mikermcneil commented 11 years ago

Is this in the main branch or in the browserify version?

On Tue, Sep 10, 2013 at 7:34 PM, Cody Stoltman notifications@github.comwrote:

The Bound Model Collection Hooks described here: https://github.com/balderdashy/mast/wiki/Bound-Model-Collection-Hooks get called in the window context so you don't have access to view with this.el .

— Reply to this email directly or view it on GitHubhttps://github.com/balderdashy/mast/issues/126 .

Mike McNeil Founder http://www.linkedin.com/in/mikermcneil/ http://twitter.com/mikermcneil http://github.com/balderdashy

   C      O
  NFI    DEN
  TIA   L i
  nfo  rma
  tion in
   tended
only for t      he addressee(s).

If you are not the intended recipient, empl oyee or agent responsible for delivery to the intended recipient(s), please be aware that any review, dissemination, use,distribut ion or copying of this message and its contents is strictly prohibited. If you receive this email in error, ple ase notify the sender and destroy any paper or electronic copies immediately.

particlebanana commented 11 years ago

browserify version. Same with #127 I'll try and play with it a bit tom. but for now I'm just going to use the manual event delegator.

mikermcneil commented 11 years ago

@ghernandez345 Can you test that the following definitions always have the proper context when they are defined as functions? (this should equal the current component)

model collection afterRender beforeClose afterReset afterAdd afterRemove afterChange afterChange.foo Event handlers (events['click .foo']) Top-level event handlers (e.g. click .foo)

Even though some of those aren't usually functions, they can be specified as such, so we should test.

mikermcneil commented 10 years ago

@tkh44 @particlebanana @ghernandez345 Let me know if this is still an issue for you guys and I'll fix if necessary

particlebanana commented 10 years ago

I ran into an issue with afterAdd not being bound to the component's collection correctly. I didn't check the other collection event handlers. Not sure what branch it was on though.