WebReflection / WebReflection/linkedom

[FEATURE] Implement `Element`'s `getHTML()` to improve SSR of web components

Open
#317 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
2.1k
Forks
104
PR merge metrics
No merged PRs in 30d

Description

Hello,

As per https://github.com/WebReflection/linkedom/issues/210#issuecomment-3803892846, I am filing an issue to add support for getHTML().

Recently baseline (2024) across browsers, makes sense to implement in Linkedom. MDN

Element.getHTML({serializableShadowRoots: true})

Example

<hello-world>
    <span>Slotted Hello World!</span>
</hello-world>
class HelloWorld extends HTMLElement {
    constructor() {
        super();
        this.attachShadow({ mode: "open", serializable: true });
    }

    ....
}

Rendered as this:

<hello-world>
      <span>Slotted Hello World</span>
      <template shadowroot="open" shadowrootserializable="">
          <style>
              :host {
                  display: inline-block;
                  background: pink;
                  border: 2px dashed yellow;
              }
          </style>
          <div><slot></slot></div>
      </template>
</hello-world>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no file or test. Start with the Element.getHTML API and the linked MDN documentation, then identify Linkedom’s existing Element serialization entry point. Compare the requested serializable shadow-root output with the example; done means supporting the described output for web components and shadow roots.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.