Building Enterprise HTML5 Application

jQuery.fn.bEmpty

$.fn.bEmpty()

Same as the standard jQuery.fn.remove but just process the destroy logic for the children views of this element. Once all the children view destroy are performed, the standard jQuery.fn.empty() on this element will be called.

It is critical to call $element.bEmpty() rather then $element.empty() any time the $element might have some children views.

Examples

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

$parentContainer.bEmpty();

// 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.
 
// Note that a 
view.$el.bEmtpy(); 
// would not perform the destroy lifecycle on the view
// as it will only empty the children (as per the jQuery API specification);

Ask, learn, share about brite.js

Go to brite.js G+ community