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

document an example of using Declarative Shadow DOM by setting shadowRoot.innerHTML #181

Open
thescientist13 opened this issue Dec 5, 2024 · 0 comments
Assignees
Labels
0.16.0 documentation Improvements or additions to documentation
Milestone

Comments

@thescientist13
Copy link
Member

Type of Change

Documentation

Summary

As part of the discussions / patterns being discussed #177 , one thing that seemed valuable now to we are making it so that users can do this without having to manually insert a <template> tag

// before
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
   <template shadowrootmode="open">
     <header>
       <h1>Welcome to my site!</h1>
     </header>
   </template>
`;
// after
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
   <header>
     <h1>Welcome to my site!</h1>
   </header>
`;

Details

So somewhere we should

  1. compliment our examples that use this.shadowRoot.appendChild(template.content.cloneNode(true)); with shadowRoot.innerHTML
  2. I think this example was meant to demonstrate innerHTML (no shadow root) - https://merry-caramel-524e61.netlify.app/examples/#server-rendering-ssr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.16.0 documentation Improvements or additions to documentation
Projects
Status: 🔖 Ready
Development

No branches or pull requests

1 participant