Building Enterprise HTML5 Application

jQuery.fn.bRemove

$.fn.bRemove()

Same as the standard jQuery.fn.remove but make sure the destroy lifecyle logic is process for any associated View to this element or its children. Once the eventual views destroy lifecycle are performed, the standard jQuery.fn.remove on this element will be called.

It is critical to call bRemove on any HTMLElement that can be or contain Views. It makes sure that brite can manage the appropriate lifecycle. Brite does not overtake jQuery.fn.remove, as we think it would be bad to change standard implementation and that the view check might not be necessary in all the cases, but $element.bRemove() should be used over $element.remove() everytime there is the slightest doubt.

Examples

var $parentContainer = $("#parentContainer");
  
brite.display("MyView",$parentContainer);

$parentContainer.bRemove();

// The MyView.destroy will be called if defined 
// and all the window, document, and dao event binding associated to the above 
// view will be unbound as well.
 

Ask, learn, share about brite.js

Go to brite.js G+ community