-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Problems with empty attributes #137
Comments
The return value of Line 9 in 132769d
Can you elaborate more on this? I think there's a snippet of code that's get removed by GH because you're not using a code block. As for If you can send a failing test case that would be great |
Maybe I misunderstood something, but if your HTML is Based on HTML spec, this is expected behavior. If you don't want to get the warning from React, you need to remove all empty string for non-boolean attribute in the HTML, or using custom transform to remove invalid boolean attribute |
I think I know the issue here, not all attributes are eligible as boolean attribute, so it should not be treated as such I will find a way to check whether attribute is a boolean attribute without increasing bundle size too much because hardcoding a list is not preferable |
Published as Thanks for raising this issue! |
htmr/src/mapAttribute.ts
Line 49 in b691b2d
Hi the way this detects truthy attributes does make sense, but since the definition for the RawProperties doesn't allow for boolean values, it gets type casted to a string with the value "true"
htmr/src/mapAttribute.ts
Line 3 in b691b2d
This is causing problems parsing and rendering some things. For example
<img alt="" src="Something"/>
will end up with alt="true" and if you substribute a react component on top it will complain that alt="true' ie.Warning: Received
truefor a non-boolean attribute
alt``Thanks
Andy
The text was updated successfully, but these errors were encountered: