Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@AndrewJakubowicz
Copy link
Contributor

Issue: #189
RFC: lit/rfcs#21
Full prototype PR: #3984

Why

Raw text elements are tricky, and are special cased in the lit prepare phase. This is because comments within raw text elements become raw text.

The following html: <textarea><!--?lit$1234$--></textarea>, renders as:

Screenshot 2023-08-01 at 2 10 22 PM

In runtime lit-html we walk the text within a raw text element and split up the text into separate Text nodes. Then we can refer to a specific text node for dynamic content. Unfortunately we cannot represent adjacent text nodes in a prepared HTML string so the compiler cannot currently optimize this structure.

Solution

Currently, if a raw text element contains any bindings, do not optimize that template.

Test plan

Added a golden test.

@changeset-bot
Copy link

changeset-bot bot commented Aug 1, 2023

🦋 Changeset detected

Latest commit: 8f1d6f9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2023

📊 Tachometer Benchmark Results

Summary

A summary of the benchmark results will show here once they finish.

Results

The full results of your benchmarks will show here once they finish.

tachometer-reporter-action v2 for Benchmarks

Copy link
Collaborator

@rictic rictic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simple and elegant!

@AndrewJakubowicz AndrewJakubowicz merged commit b2e42e1 into main Aug 1, 2023
@AndrewJakubowicz AndrewJakubowicz deleted the compiler-handle-raw-text-elements branch August 1, 2023 21:27
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.

2 participants