Skip to content

Conversation

@armgjoka
Copy link
Contributor

What is it?

  • Feature / enhancement
  • Bug
  • Docs / tests

This JSX: <div style={{display: undefined}}">
Results in:


Should be:

Link: (#340)

const handleStyle: PropHandler = (ctx, elm, _, newValue) => {
setAttribute(ctx, elm, 'style', stringifyClassOrStyle(newValue, false));
const style = stringifyClassOrStyle(newValue, false);
if (Object.keys(style).length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be:

  if (style.length > 0) {

since. its already a string.

Actually, why do we need this if statement at all, I can see a problem that styles never get removed.

Copy link
Contributor Author

@armgjoka armgjoka Apr 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manucorporat, yes you are right, for some reason saw that as object. My idea was to handle the case where style would be an empty string:
"style={{display: undefined}}" to "style='' ".

@manucorporat manucorporat enabled auto-merge (squash) April 15, 2022 18:37
@manucorporat manucorporat merged commit a92e2f3 into QwikDev:main Apr 15, 2022
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.

2 participants