Skip to content
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

class:name={ true } in combination with spread arguments is deleted on update #3421

Closed
cvlab opened this issue Aug 17, 2019 · 0 comments · Fixed by #3781
Closed

class:name={ true } in combination with spread arguments is deleted on update #3421

cvlab opened this issue Aug 17, 2019 · 0 comments · Fixed by #3781
Labels

Comments

@cvlab
Copy link
Contributor

cvlab commented Aug 17, 2019

Describe the bug
class:name={ true } in combination with spread arguments is deleted on spread arguments update

To Reproduce
REPL https://svelte.dev/repl/ff608fce63184816a57bbb5ae0ea7bd3?version=3.8.1

Additional context

<h1 class="cls" class:red={ true } { ...{ style } }>

update function is

p(changed, ctx) {
	set_attributes(h1, get_spread_update(h1_levels, [
		{ class: "cls svelte-kwtnbw" },
		(changed.style) && { style: ctx.style }
	]));
},

Because get_spread_update change class attribute and there is no toggle class call for red class, red class is deleted. Good solution is to compile truthy values of class:name={truthy} like static.

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