mirror of
https://github.com/withastro/astro.git
synced 2025-01-27 22:19:04 -05:00
wip: cherry-pick jsx-runtime fix?
This commit is contained in:
parent
39f48dd031
commit
b4958f6563
2 changed files with 14 additions and 0 deletions
|
@ -15,3 +15,7 @@ Written by: {new Intl.ListFormat('en').format(authors.map(d => d.name))}.
|
|||
Published on: {new Intl.DateTimeFormat('en', {dateStyle: 'long'}).format(published)}.
|
||||
|
||||
<Counter client:idle>This is a **counter**!</Counter>
|
||||
|
||||
```js
|
||||
export const code = true
|
||||
```
|
||||
|
|
|
@ -575,6 +575,16 @@ Make sure to use the static attribute syntax (\`${key}={value}\`) instead of the
|
|||
return markHTMLString(` ${key.slice(0, -5)}="${listValue}"`);
|
||||
}
|
||||
|
||||
// support object styles for better JSX compat
|
||||
if (key === 'style' && typeof value === 'object') {
|
||||
return markHTMLString(` ${key}="${toStyleString(value)}"`);
|
||||
}
|
||||
|
||||
// support `className` for better JSX compat
|
||||
if (key === 'className') {
|
||||
return markHTMLString(` class="${toAttributeString(value, shouldEscape)}"`);
|
||||
}
|
||||
|
||||
// Boolean values only need the key
|
||||
if (value === true && (key.startsWith('data-') || htmlBooleanAttributes.test(key))) {
|
||||
return markHTMLString(` ${key}`);
|
||||
|
|
Loading…
Add table
Reference in a new issue