Skip to content

Style attribute not rendered if semi colon is in a conditional expression #8239

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

Closed
JohnnyFun opened this issue Jan 31, 2023 · 4 comments
Closed
Labels

Comments

@JohnnyFun
Copy link

Describe the bug

The REPL below shows it, but let me know if you need any more information.

Reproduction

https://svelte.dev/repl/468121c989c9473784293ccf9614b0c7?version=3.55.1

Logs

No response

System Info

Latest chrome on windows 11. User agent is: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"

Severity

annoyance

@eltigerchino
Copy link
Member

The bug also occurs without the conditional expression.

<script>
	export let style = ";background:yellow;"
</script>

<h1 style="color:red{style}">Should be yellow background, red text</h1>

https://svelte.dev/repl/31a0c3277fec41b8b9522ee7a697f262?version=3.55.1

@gtm-nayan
Copy link
Contributor

Seems to be the same as #5204

It was closed by the style directive PR but the bug remains, and probably any sort of attempted optimization would break in the case of interpolated strings.

People were originally opposed to removing that optimization but not sure what the consensus is now with the style directive in place.

@Rich-Harris
Copy link
Member

This works in Svelte 5 since we didn't add the optimisation (and if we did, then we'd likely take a different approach), so I'll close this

(note that the second <h1> says it should have red text, so it might look like it's not working, but that's incorrect)

@JohnnyFun
Copy link
Author

Oh apologies for that 2nd <h1> confusion, Rich! I must've forgotten to remove that after testing some other idea or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants