Skip to content

Commit

Permalink
Remove ember-wormhole-placeholder, rename placeholders
Browse files Browse the repository at this point in the history
Placeholders renamed from _firstNode and _lastNode to _wormholeHeadNode
and _wormholeTailNode
  • Loading branch information
bantic committed Jun 8, 2016
1 parent 0f156ac commit 2af706c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
14 changes: 7 additions & 7 deletions addon/components/ember-wormhole.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export default Component.extend({
this._dom = this.renderer._dom;

// Create text nodes used for the head, tail
this._firstNode = this._dom.document.createTextNode('');
this._lastNode = this._dom.document.createTextNode('');
this._wormholeHeadNode = this._dom.document.createTextNode('');
this._wormholeTailNode = this._dom.document.createTextNode('');

// A prop to help in the mocking of didInsertElement timing for Fastboot
this._didInsert = false;
Expand All @@ -57,7 +57,7 @@ export default Component.extend({
this._didInsert = true;
run.schedule('afterRender', () => {
if (this.isDestroyed) { return; }
this._element = this._firstNode.parentNode;
this._element = this._wormholeHeadNode.parentNode;
if (!this._element) {
throw new Error('The head node of a wormhole must be attached to the DOM');
}
Expand All @@ -70,15 +70,15 @@ export default Component.extend({
// not called in fastboot
this._super(...arguments);
this._didInsert = false;
let { _firstNode, _lastNode } = this;
let { _wormholeHeadNode, _wormholeTailNode } = this;
run.schedule('render', () => {
this._removeRange(_firstNode, _lastNode);
this._removeRange(_wormholeHeadNode, _wormholeTailNode);
});
},

_destinationDidChange: observer('destinationElement', function() {
var destinationElement = this.get('destinationElement');
if (destinationElement !== this._firstNode.parentNode) {
if (destinationElement !== this._wormholeHeadNode.parentNode) {
run.schedule('render', this, '_appendToDestination');
}
}),
Expand All @@ -94,7 +94,7 @@ export default Component.extend({
}

var currentActiveElement = getActiveElement();
this._appendRange(destinationElement, this._firstNode, this._lastNode);
this._appendRange(destinationElement, this._wormholeHeadNode, this._wormholeTailNode);
if (currentActiveElement && getActiveElement() !== currentActiveElement) {
currentActiveElement.focus();
}
Expand Down
5 changes: 0 additions & 5 deletions addon/helpers/ember-wormhole-placeholder.js

This file was deleted.

4 changes: 2 additions & 2 deletions addon/templates/components/ember-wormhole.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{ember-wormhole-placeholder (unbound _firstNode) ~}}
{{unbound _wormholeHeadNode ~}}
{{yield ~}}
{{ember-wormhole-placeholder (unbound _lastNode) ~}}
{{unbound _wormholeTailNode ~}}

0 comments on commit 2af706c

Please sign in to comment.