Skip to content

Commit

Permalink
Implement remove() for SC.View
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhuda committed Apr 16, 2011
1 parent ace3358 commit a4daefb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions frameworks/core_foundation/views/core_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,21 @@ SC.CoreView = SC.Responder.extend(
return this.appendTo(document.body);
},

/**
Removes the view's element from the element to which it is attached.
@returns {SC.View} receiver
*/
remove: function() {
this.$().remove();

// What we should really do here is wait until the end of the run loop
// to determine if the element has been re-appended to a different element.
// In the interim, we will just re-render if that happens. It is more
// important than elements get garbage collected.
this.destroyElement();
},

/**
The ID to use when trying to locate the layer in the DOM. If you do not
set the layerId explicitly, then the view's GUID will be used instead.
Expand Down

0 comments on commit a4daefb

Please sign in to comment.