-
-
Notifications
You must be signed in to change notification settings - Fork 924
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={undefined} becomes class="undefined" #955
Comments
Yep legit and really quite annoying. To have a property follow attribute rules. I figured properties weren't subject to this, but this one is. |
OK, I was worried that |
Yeah I was leaning that way. Also have to consider special case in spreads. This is how Inferno handles it though.. It does remove it as an attribute but sets it as a property. |
That does look like a good way to do it. |
Yeah still requires touching a bunch of stuff including compiled output.. and adding a className helper. This is probably a minor version sort of change. |
Describe the bug
<div class={undefined}/>
renders as<div class="undefined"></div>
. Or more precisely, it compiles to_el$.className = undefined;
which is equivalent to_el$.className = "undefined";
apparently.By contrast,
<div foo={undefined}/>
renders as<div/>
. Or more precisely, it compiles tosetAttribute(_el$, "foo", undefined);
which is equivalent to removing the attribute.Your Example Website or App
https://playground.solidjs.com/?hash=854479419&version=1.3.13
Steps to Reproduce the Bug or Issue
Expected behavior
I expect
<div class={undefined}/>
to behave like<div foo={undefined}/>
in that both omit the attribute.Screenshots or Videos
No response
Platform
Additional context
I guess the main alternative here is to compile to using
setAttribute
instead ofclassName
. I'm not sure whether there are unintended consequences to that (bigger code output, maybe efficiency?).Pointed out by RodrigOv on Discord in #general.
The text was updated successfully, but these errors were encountered: