Skip to content

Commit

Permalink
[fix] Hyphen Case of CSS
Browse files Browse the repository at this point in the history
Property updating
  • Loading branch information
TechQuery committed Nov 8, 2024
1 parent 1877c2e commit a41040d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dom-renderer",
"version": "2.4.1",
"version": "2.4.2",
"license": "LGPL-3.0-or-later",
"author": "shiy2008@gmail.com",
"description": "A light-weight DOM Renderer supports Web components standard & TypeScript language",
Expand Down
4 changes: 2 additions & 2 deletions source/dist/DOMRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ export class DOMRenderer {
(oldVNode.node as HTMLElement).style,
oldVNode.style,
newVNode.style,
(node, key) => node.removeProperty(key),
(node, key, value) => node.setProperty(key, value)
(node, key) => node.removeProperty(toHyphenCase(key)),
(node, key, value) => node.setProperty(toHyphenCase(key), value)
);
this.updateChildren(
oldVNode.node as ParentNode,
Expand Down
4 changes: 2 additions & 2 deletions test/jsx-runtime.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ describe('JSX runtime', () => {

it('should render JSX to DOM', () => {
renderer.render(
<a href="https://idea2.app/" style={{ color: 'red' }}>
<a href="https://idea2.app/" style={{ fontSize: '2rem', '--color': 'red' }}>
idea2app
</a>
);
expect(document.body.innerHTML).toBe(
'<a href="https://idea2.app/" style="color: red;">idea2app</a>'
'<a href="https://idea2.app/" style="font-size: 2rem; --color: red;">idea2app</a>'
);
});

Expand Down

0 comments on commit a41040d

Please sign in to comment.