Skip to content

Commit 8582f23

Browse files
committed
fix: On empty className w/ compat, class attr will no longer be duplicated
1 parent 6214991 commit 8582f23

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ const SHALLOW = { shallow: true };
1515
// components without names, kept as a hash for later comparison to return consistent UnnamedComponentXX names.
1616
const UNNAMED = [];
1717

18-
const VOID_ELEMENTS = /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;
18+
const VOID_ELEMENTS =
19+
/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;
1920

2021
const UNSAFE_NAME = /[\s\n\\/='"\0<>]/;
2122

@@ -247,7 +248,7 @@ function _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
247248
if (name === 'defaultValue') {
248249
name = 'value';
249250
} else if (name === 'className') {
250-
if (props.class) continue;
251+
if (typeof props.class !== 'undefined') continue;
251252
name = 'class';
252253
} else if (isSvgMode && name.match(/^xlink:?./)) {
253254
name = name.toLowerCase().replace(/^xlink:?/, 'xlink:');

0 commit comments

Comments
 (0)