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

Declarative ShadowDOM does not work as shown in Docs #668

Closed
rossanmol opened this issue Nov 30, 2022 · 2 comments · Fixed by #935
Closed

Declarative ShadowDOM does not work as shown in Docs #668

rossanmol opened this issue Nov 30, 2022 · 2 comments · Fixed by #935
Assignees
Labels
bug Something isn't working

Comments

@rossanmol
Copy link

Describe the bug
I have copied the code written in your Docs, in Node 14/16/18. And the output was:

                <my-custom-element><template shadowroot="open">
                            <style>
                                :host {
                                    display: inline-block;
                                    background: red;
                                }
                            </style>
                            <div><slot></slot></div>
                        </template></my-custom-element>

To Reproduce
Steps to reproduce the behavior:

  1. Copy code from Docs
  2. Execute code in node (14/16/18)
  3. Notice the output in console

Expected behavior

<my-custom-element>
    <span>Slotted content</span>
    <template shadowroot="open">
        <style>
            :host {
                display: inline-block;
                background: red;
            }
        </style>
        <div><slot></slot></div>
    </template>
</my-custom-element>

Screenshots
image

Device:

  • OS: MacOS Monterey 12.6
  • Browser Node
  • Version 14/16/18
@rossanmol rossanmol added the bug Something isn't working label Nov 30, 2022
@Heydon
Copy link

Heydon commented Dec 10, 2022

@rossanmol Thanks for posting this. I have exactly the same experience. The light DOM (<span>Slotted content</span> in this example) is not preserved in any of my cases either.

@capricorn86 capricorn86 self-assigned this May 23, 2023
capricorn86 added a commit that referenced this issue May 23, 2023
…he HTMLUnknownElement that gets replaced by a custom element when it is defined by calling CustomElementRegistry.define() after it is used.
capricorn86 added a commit that referenced this issue May 23, 2023
…om-does-not-work-as-shown-in-docs

#668@patch: Fixes issue where all properties didn't get copied from t…
@capricorn86
Copy link
Owner

Thank you for reporting @rossanmol and @Heydon! 🙂

The issue has finally been fixed.

You can read more about the release here:
https://github.com/capricorn86/happy-dom/releases/tag/v9.20.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants