AmpersandJS / ampersand-view-switcher

A utility for swapping out views inside a container element.
MIT License
23 stars 13 forks source link

Don't use view.rendered to determine whether render must be called #25

Open kahnvex opened 9 years ago

kahnvex commented 9 years ago

Using view.rendered to determine whether or not to render a view might cause issues with views with bindings that have been rendered once before. There is a discussion on ampersand-view about this.

Some alternatives:

// very naive and hacky way to check if an element is in the DOM
document.contains(view.el);

// Maybe a little better
// When removing an element
view.remove();
delete view.el;

// Set our own property
view.remove();
view.removed = true;

This is a tough problem but I think we can find a solution.

DoomyTheFroomy commented 9 years ago

:+1:

cdaringe commented 9 years ago

See AmpersandJS/ampersand-view#146