Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

injecting ViewSlot removes Container #231

Closed
joelcoxokc opened this issue Dec 9, 2015 · 0 comments
Closed

injecting ViewSlot removes Container #231

joelcoxokc opened this issue Dec 9, 2015 · 0 comments
Assignees
Labels

Comments

@joelcoxokc
Copy link
Contributor

This is a very interesting bug, so read closely to see what is happening.

given two customElements

<outer-element> and <inner-element>

Here is the class Implementations

export class OuterElement {}

@inject(ViewSlot)
export class InnerElement {}

Notice how the InnerElement has ViewSlot Injected.

When the view Slot is injected... If the inner-element is nested as a direct child inside the outer-element, it will loose it's container

For Example

<outer-element>
    <inner-element>
         <p>I am the inner Elements Content</p>
    </inner-element>
</outer-element>

The previous HTML when previewed in the DOM will produce the following.

<outer-element>

         <p>I am the inner Elements Content</p>

</outer-element>

If We simply wrap the inner-element in any NON CustomElement tag, then the container Remains.

For Example

<outer-element>
    <div>
        <inner-element>
             <p>I am the inner Elements Content</p>
        </inner-element>
    </div>
</outer-element>

The previous HTML when previewed in the DOM will produce the following

<outer-element>
    <div>
        <inner-element>
             <p>I am the inner Elements Content</p>
        </inner-element>
    </div>
</outer-element>

This same issue exists with the router-view.

If you place the router-view as a direct child to a customElement, it will loose it's container.

There is something happening when ViewSlot get's injected, and when the Elements parent containerNode is a customElement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants