Skip to content

Commit

Permalink
Remove View#destroyElement method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Jackson committed Jul 26, 2016
1 parent fcd906e commit 5327eb0
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 106 deletions.
24 changes: 0 additions & 24 deletions packages/ember-views/lib/mixins/view_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,30 +325,6 @@ export default Mixin.create({
*/
willClearRender: K,

/**
Destroys any existing element along with the element for any child views
as well. If the view does not currently have a element, then this method
will do nothing.
If you implement `willDestroyElement()` on your view, then this method will
be invoked on your view before your element is destroyed to give you a
chance to clean up any event handlers, etc.
If you write a `willDestroyElement()` handler, you can assume that your
`didInsertElement()` handler was called earlier for the same element.
You should not call or override this method yourself, but you may
want to implement the above callbacks.
@method destroyElement
@return {Ember.View} receiver
@private
*/
destroyElement() {
this._currentState.destroyElement(this);
return this;
},

/**
You must call `destroy` on a view to destroy the view (and all of its
child views). This will remove the view from any parent node, then make
Expand Down
2 changes: 0 additions & 2 deletions packages/ember-views/lib/views/states/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export default {
return true; // continue event propagation
},

destroyElement() { },

destroy() { },

rerender(view) {
Expand Down
3 changes: 0 additions & 3 deletions packages/ember-views/lib/views/states/destroying.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ assign(destroying, {
},
rerender() {
throw new EmberError('You can\'t call rerender on a view being destroyed');
},
destroyElement() {
throw new EmberError('You can\'t call destroyElement on a view being destroyed');
}
});

Expand Down
4 changes: 0 additions & 4 deletions packages/ember-views/lib/views/states/has_element.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ assign(hasElement, {
view.renderer.rerender(view);
},

destroyElement(view) {
view.renderer.remove(view, false);
},

destroy(view) {
view.renderer.remove(view, true);
},
Expand Down
22 changes: 0 additions & 22 deletions packages/ember-views/tests/views/view/append_to_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,6 @@ QUnit.test('raises an assert when a target does not exist in the DOM', function(
});


QUnit.test('remove removes an element from the DOM', function() {
willDestroyCalled = 0;

view = View.create({
willDestroyElement() {
willDestroyCalled++;
}
});

ok(!get(view, 'element'), 'precond - should not have an element');

run(() => view.append());

ok(jQuery('#' + get(view, 'elementId')).length === 1, 'precond - element was inserted');

run(() => view.destroyElement());

ok(jQuery('#' + get(view, 'elementId')).length === 0, 'remove removes an element from the DOM');
ok(!get(view, 'element'), 'remove nulls out the element');
equal(willDestroyCalled, 1, 'the willDestroyElement hook was called once');
});

QUnit.test('destroy more forcibly removes the view', function() {
willDestroyCalled = 0;

Expand Down
51 changes: 0 additions & 51 deletions packages/ember-views/tests/views/view/destroy_element_test.js

This file was deleted.

0 comments on commit 5327eb0

Please sign in to comment.