Skip to content

Commit 27305b9

Browse files
committed
fix: convert some jsx attributes
1 parent 01ccabb commit 27305b9

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/jsx-runtime.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,21 @@ export const jsxs = jsx
2424
// function jsxDEV(type, props , maybeKey, isStaticChildren, source, self)
2525
export const jsxDEV = jsx
2626

27-
function jsxKeyToSvelte(key) {
28-
if (key === 'className') return 'class'
27+
// Somne special jsx attribute handling: https://reactjs.org/docs/dom-elements.html
28+
const MAPPED_ATTRIBUTES = new Map([
29+
['className', 'class'],
30+
['htmlFor', 'for'],
31+
['tabIndex', 'tabindex'],
32+
['readOnly', 'readonly'],
33+
['autoComplete', 'autocomplete'],
34+
['autoFocus', 'autofocus'],
35+
['contentEditable', 'contenteditable'],
36+
['noValidate', 'novalidate'],
37+
])
2938

39+
function jsxKeyToSvelte(key) {
3040
return (
41+
MAPPED_ATTRIBUTES.get(key) ||
3142
key
3243
// - on_eventname => on:eventname
3344
// - bind_name => bind:name

0 commit comments

Comments
 (0)