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

updateStyle(): use setProperty() when css vars and dashed-properties, fixes #2989 #2991

Merged
merged 3 commits into from
Nov 18, 2024

Conversation

kfule
Copy link
Contributor

@kfule kfule commented Nov 15, 2024

Description

This PR changes updateStyle() to use setProperty() for dashed-properties.

Motivation and Context

This PR maybe fixes #2989

Current mithril (v2.2.10) doesn't seem to work well when using something like domMock, which doesn't have enough support for dashed-properties.
It may not be a browser that Mithril officially supports. But the fix is clear and has little or no impact on performance as discussed in #2985.

How Has This Been Tested?

npm run test

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My change requires a documentation update, and I've opened a pull request to update it already:
  • I have read https://mithril.js.org/contributing.html.

@kfule kfule requested a review from a team as a code owner November 15, 2024 12:05
@dead-claudia
Copy link
Member

dead-claudia commented Nov 15, 2024

Welp, thought we could get away with #2985 (comment), but turns out that was too breaking...

Edit: I'm keeping it in #2982, though - anyone claiming to implement a web browser or the full DOM should be implementing those properties, and bug reports should be directed at those who claim to do so and don't.

Copy link
Member

@dead-claudia dead-claudia left a comment

Choose a reason for hiding this comment

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

Please add a test spying on a style setter to make sure we're only using camel case setters.

@kfule
Copy link
Contributor Author

kfule commented Nov 16, 2024

@dead-claudia OK, test added.

render/tests/test-updateElement.js Outdated Show resolved Hide resolved
render/tests/test-updateElement.js Show resolved Hide resolved
render/tests/test-updateElement.js Show resolved Hide resolved
@dead-claudia dead-claudia merged commit ffafe51 into MithrilJS:main Nov 18, 2024
7 checks passed
@JAForbes JAForbes mentioned this pull request Nov 18, 2024
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.

v2.2.10 Breaks CSS text in happy-dom/vitest?
2 participants