ripplejs / ripple

A tiny foundation for building reactive views
http://ripplejs.github.io
1.28k stars 66 forks source link

Child views have the same lifecycle handlers #21

Closed anthonyshort closed 10 years ago

anthonyshort commented 10 years ago

With the each plugin, the dynamic views that are created have the same lifecycle handlers as the parent view because we're just re-using that parent constructor.

eg. You create a View and add a created handler. Then you use the each plugin and for each view that is created for the items, that created handler will be fired.

It needs to be changed to something like:

function ChildView(){
  View.apply(this, arguments);
}
ChildView.prototype = Object.create(View.prototype);

But then it missed out on parse - but that should probably be on the prototype.

Or just create a new ripple view. This creates a cyclical dependency which is pretty hard for standalone builds.

anthonyshort commented 10 years ago

Fixed in 0.4.0.