Skip to content

HydrateElement base class prototyping #29

@thescientist13

Description

@thescientist13

Type of Change

  • Other

Summary

Initially started in ProjectEvergreen/greenwood#548, but wcc may provide a nice sandbox for something testing something like this out.

Latest prototype looks something like this

// https://web.dev/declarative-shadow-dom/#hydration
class HydrateElement extends HTMLElement {
  // attach the shadow
  connectedCallback() {
    if (!this.shadowRoot) {
      this.attachShadow({ mode: 'open' });
      this.shadowRoot.appendChild(template.content.cloneNode(true));
    }
  }
}

/*
<style>
  x-foo:not(:defined) > * {
    display: none;
  }
</style>
*/

export { HydrateElement };

Details

Some other ideas / feature that have come up while working on wcc that are worth tracking as part of this

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions