Skip to content

optimise style attribute for template literal #5210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

tanhauhau
Copy link
Member

Tangentially related to #5204, i noticed that there's no optimisation for

<div style={`color: ${color}`}></div>

which should be similar to

<div style='color: {color}'></div>

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases, features are absent for a reason.
  • This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
  • Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. (Remember to npm run lint!)

Tests

  • Run the tests with npm test or yarn test)

@tanhauhau tanhauhau changed the title consider template literal the same as text with expression optimise style attribute for template literal Jul 25, 2020
@trbrc
Copy link
Contributor

trbrc commented Jul 25, 2020

Wait, wouldn't this just break the workaround for #5204 too? E.g. both h1's in the REPL repro I posted would be broken? Maybe I'm misreading this PR but it doesn't seem like a good idea as long as the optimization has this problem.

@Conduitry
Copy link
Member

I think this is probably not a pattern we want to be encouraging. It seems reasonable to me to leave this unoptimized in case someone is doing something weird and needs to opt out.

@Conduitry Conduitry closed this Aug 5, 2020
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.

3 participants