Skip to content

Commit fec93c5

Browse files
committed
fix for JSX mode being difficult to assert over due to self-closing tags
1 parent b661daa commit fec93c5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export default function renderToString(vnode, context, opts, inner) {
108108
if (!(opts && opts.allAttributes) && (name==='key' || name==='ref')) continue;
109109

110110
let hooked = opts.attributeHook && opts.attributeHook(name, v, context, opts);
111-
if (hooked) {
111+
if (hooked || hooked==='') {
112112
s += hooked;
113113
continue;
114114
}

src/jsx.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ let prettyFormatOpts = {
2121

2222

2323
function attributeHook(name, value, context, opts) {
24+
if (value==null) return '';
25+
2426
let indentChar = typeof opts.pretty==='string' ? opts.pretty : '\t';
2527
if (typeof value!=='string') {
2628
preactPlugin.context = context;

0 commit comments

Comments
 (0)