Skip to content

Implement rendering on top of the DOM Parts prototype - #1

Draft
rictic wants to merge 25 commits into
mainfrom
dom-parts
Draft

rictic wants to merge 25 commits into
mainfrom
dom-parts

Conversation

@rictic

@rictic rictic commented Jul 17, 2023

Copy link
Copy Markdown
Owner

This uses an unoptimized one-time template prep step, building on top of Lit's getTemplateHtml function to generate the DOM parts, but for all subsequent renders of that template we can use a fast clone.

Currently does feature detection by looking for ChildNodePart. When that's not present, it falls back to the existing implementation.

One issue with the implementation in Chrome Canary right now, it seems like a ChildNodePart can't be used with nodes that have a document fragment as their parent: https://lit.dev/playground/#gist=fed0fb43c92cd1198e66f84b34ad48d4

Unfortunately this is a pattern we do a ton in our unit tests.

rictic added 10 commits July 17, 2023 11:52
This has the tests passing in a mainline browser without DOM Parts, ~30 tests fail when running with DOM Parts.
Needed to support an additional attribute encoding for this. Chrome Canary with experimental web platform features escapes `<` and `>` in attribute values in the innerHTML serialization.

This is getting a somewhat old canary though, it doesn't have the DOM Parts prototype.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant