Skip to content

Commit a41040d

Browse files
committed
[fix] Hyphen Case of CSS
Property updating
1 parent 1877c2e commit a41040d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dom-renderer",
3-
"version": "2.4.1",
3+
"version": "2.4.2",
44
"license": "LGPL-3.0-or-later",
55
"author": "[email protected]",
66
"description": "A light-weight DOM Renderer supports Web components standard & TypeScript language",

source/dist/DOMRenderer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ export class DOMRenderer {
170170
(oldVNode.node as HTMLElement).style,
171171
oldVNode.style,
172172
newVNode.style,
173-
(node, key) => node.removeProperty(key),
174-
(node, key, value) => node.setProperty(key, value)
173+
(node, key) => node.removeProperty(toHyphenCase(key)),
174+
(node, key, value) => node.setProperty(toHyphenCase(key), value)
175175
);
176176
this.updateChildren(
177177
oldVNode.node as ParentNode,

test/jsx-runtime.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ describe('JSX runtime', () => {
1717

1818
it('should render JSX to DOM', () => {
1919
renderer.render(
20-
<a href="https://idea2.app/" style={{ color: 'red' }}>
20+
<a href="https://idea2.app/" style={{ fontSize: '2rem', '--color': 'red' }}>
2121
idea2app
2222
</a>
2323
);
2424
expect(document.body.innerHTML).toBe(
25-
'<a href="https://idea2.app/" style="color: red;">idea2app</a>'
25+
'<a href="https://idea2.app/" style="font-size: 2rem; --color: red;">idea2app</a>'
2626
);
2727
});
2828

0 commit comments

Comments
 (0)