Skip to content

Commit

Permalink
Fix Substitution regression after buildIn/Out
Browse files Browse the repository at this point in the history
  • Loading branch information
romancortes authored and marchant committed Jun 8, 2016
1 parent 3ecf11d commit afc0f7c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 45 deletions.
80 changes: 41 additions & 39 deletions ui/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -2447,7 +2447,6 @@ var Component = exports.Component = Target.specialize(/** @lends Component.proto
_performDomContentChanges: {
value: function () {
var contents = this._newDomContent,
oldContent = this._element.childNodes[this._element.childNodes.length - 1],
element,
elementToAppend,
i;
Expand Down Expand Up @@ -2475,10 +2474,7 @@ var Component = exports.Component = Target.specialize(/** @lends Component.proto

this._newDomContent = null;
if (typeof this.contentDidChange === "function") {
this.contentDidChange(
this._element.childNodes[this._element.childNodes.length - 1],
oldContent
);
this.contentDidChange();
}
this._shouldClearDomContentOnNextDraw = false;
}
Expand Down Expand Up @@ -3125,19 +3121,21 @@ var Component = exports.Component = Target.specialize(/** @lends Component.proto
if (this._currentBuildAnimation) {
this._currentBuildAnimation.cancel();
}
if (this._isElementAttachedToParent) {
this._currentBuildAnimation = this.buildInSwitchAnimation;
} else {
this._updateActiveBuildAnimations();
this._currentBuildAnimation = this.buildInInitialAnimation;
}
if (this._currentBuildAnimation) {
this._currentBuildAnimation.play();
this._currentBuildAnimation.finished.then(function () {
self._currentBuildAnimation.cancel();
self._currentBuildAnimation = null;
self.dispatchEventNamed("buildInEnd", true, true);
}, function () {});
if (this._element && this._element.parentNode && this._element.parentNode.component) {
if (this._isElementAttachedToParent) {
this._currentBuildAnimation = this.buildInSwitchAnimation;
} else {
this._updateActiveBuildAnimations();
this._currentBuildAnimation = this.buildInInitialAnimation;
}
if (this._currentBuildAnimation) {
this._currentBuildAnimation.play();
this._currentBuildAnimation.finished.then(function () {
self._currentBuildAnimation.cancel();
self._currentBuildAnimation = null;
self.dispatchEventNamed("buildInEnd", true, true);
}, function () {});
}
}
}
},
Expand All @@ -3153,28 +3151,32 @@ var Component = exports.Component = Target.specialize(/** @lends Component.proto
this._updateActiveBuildAnimations();
this._currentBuildAnimation = this.buildOutInitialAnimation;
}
if (this._currentBuildAnimation) {
this._currentBuildAnimation.play();
this._currentBuildAnimation.finished.then(function () {
var parent = self.parentComponent;
self._currentBuildAnimation.cancel();
self._currentBuildAnimation = null;
self.detachFromParentComponent();
self.buildInAnimationOverride = null;
self.buildOutAnimationOverride = null;
self._element.parentNode.removeChild(self._element);
self._isElementAttachedToParent = false;
parent.dispatchEventNamed("buildOutEnd", true, true);
}, function () {});
} else {
this.detachFromParentComponent();
this.buildInAnimationOverride = null;
this.buildOutAnimationOverride = null;
if (this._isElementAttachedToParent) {
if (this._element.parentNode) {
this._element.parentNode.removeChild(this._element);
if (this._element && this._element.parentNode && this._element.parentNode.component) {
if (this._currentBuildAnimation) {
this._currentBuildAnimation.play();
this._currentBuildAnimation.finished.then(function () {
var parent = self.parentComponent;
self._currentBuildAnimation.cancel();
self._currentBuildAnimation = null;
self.detachFromParentComponent();
self.buildInAnimationOverride = null;
self.buildOutAnimationOverride = null;
if (self._element.parentNode.component) {
self._element.parentNode.removeChild(self._element);
}
self._isElementAttachedToParent = false;
parent.dispatchEventNamed("buildOutEnd", true, true);
}, function () {});
} else {
this.detachFromParentComponent();
this.buildInAnimationOverride = null;
this.buildOutAnimationOverride = null;
if (this._isElementAttachedToParent) {
if (this._element.parentNode && this._element.parentNode.component) {
this._element.parentNode.removeChild(this._element);
}
this._isElementAttachedToParent = false;
}
this._isElementAttachedToParent = false;
}
}
}
Expand Down
9 changes: 3 additions & 6 deletions ui/slot.reel/slot.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,13 @@ exports.Slot = Component.specialize( /** @lends Slot.prototype # */ {
},

/**
* Informs the `delegate` that `slotDidSwitchContent(slot, newContent,
* oldContent)`
* Informs the `delegate` that `slotDidSwitchContent(slot)`
* @function
* @param newContent
* @param oldContent
*/
contentDidChange: {
value: function (newContent, oldContent) {
value: function () {
if (this.delegate && typeof this.delegate.slotDidSwitchContent === "function") {
this.delegate.slotDidSwitchContent(this, newContent, (newContent ? newContent.component : null), oldContent, (oldContent ? oldContent.component : null));
this.delegate.slotDidSwitchContent(this);
}
}
}
Expand Down

0 comments on commit afc0f7c

Please sign in to comment.