Commit 8939f6f
authored
Fix: Support empty style attribute (#296)
Fixes a bug in which empty style attributes result in
unrecoverable JSX failures. For example:
```html
<div style>Foo</div>
```
Would result in the following console error:
```
Uncaught Invariant Violation: The `style` prop expects a
mapping from style properties to values, not a string.
For example, style={{marginRight: spacing + 'em'}} when
using JSX.
```
and the React JSX failing to render.
The problem is that empty properties are rendered as
boolean `true` by default. This is consistent with
HTML/React syntax interop expectations for most properties
but not `style`, which expects an `Object` value in
React-land.
Since an empty `style` attribute is semantically
meaningless (where HTML is concerned) we can simply skip
over this property.1 parent be04c33 commit 8939f6f
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
818 | 818 | | |
819 | 819 | | |
820 | 820 | | |
821 | | - | |
| 821 | + | |
822 | 822 | | |
823 | 823 | | |
824 | 824 | | |
| |||
0 commit comments