lit / lit/lit.dev

[docs] [standalone lit-html] calling render on a subtree is not recommended

Open
#1,158 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
142
Forks
230
PR merge metrics
No merged PRs in 30d

Description

Expand https://lit.dev/docs/libraries/standalone-templates/ to document that calling `render` on an element that is part of a lit managed subtree is not recommended.

Came up in discussion of https://github.com/lit/lit/issues/2189

Repro, what is the final rendered DOM?

```js
import {html, render} from 'lit';
const ui = (v1, v2) => html`

${v1}
${v2}
`;
render(ui('one', 'two'), document.body);

render(html`

Some

more

DOM

`,
document.querySelector('#binding-1')!);

render(ui('three', 'four'), document.body);
```

Contributor guide

Open the contributing guide

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

Start with the standalone templates page at lit.dev/docs/libraries/standalone-templates/ and run the supplied render example to inspect its final DOM. Update that documentation to explain why rendering into an element within a Lit-managed subtree is not recommended, including the behavior shown by the repro.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.