Skip to content

Commit

Permalink
fix(view): skip view distribution on slot fallback fix aurelia#639
Browse files Browse the repository at this point in the history
let ShadowSlot and PassThroughSlot handle nodes/view distribution themselves
  • Loading branch information
StrahilKazlachev committed Sep 6, 2018
1 parent 765a2e6 commit 1fd0363
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/shadow-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class PassThroughSlot {
renderFallbackContent(view, nodes, projectionSource, index) {
if (this.contentView === null) {
this.contentView = this.fallbackFactory.create(this.ownerView.container);
this.contentView._isSlotFallback = true;
this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext);

let slots = Object.create(null);
Expand Down Expand Up @@ -277,6 +278,7 @@ export class ShadowSlot {
renderFallbackContent(view, nodes, projectionSource, index) {
if (this.contentView === null) {
this.contentView = this.fallbackFactory.create(this.ownerView.container);
this.contentView._isSlotFallback = true;
this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext);
this.contentView.insertNodesBefore(this.anchor);
}
Expand Down
3 changes: 2 additions & 1 deletion src/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class View {
this.viewModelScope = null;
this.animatableElement = undefined;
this._isUserControlled = false;
this._isSlotFallback = false;
this.contentView = null;

for (let key in slots) {
Expand Down Expand Up @@ -166,7 +167,7 @@ export class View {
children[i].bind(bindingContext, overrideContext, true);
}

if (this.hasSlots) {
if (this.hasSlots && !this._isSlotFallback) {
ShadowDOM.distributeView(this.contentView, this.slots);
}
}
Expand Down

0 comments on commit 1fd0363

Please sign in to comment.