Skip to content

Commit 819b589

Browse files
committed
Add skipFalseAttributes option - when set to false, turns off DOM attribute skipping. Relates to #4
1 parent f349943 commit 819b589

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/jsx.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function attributeHook(name, value, context, opts, isComponent) {
2424
let type = typeof value;
2525

2626
// always skip null & undefined values, skip false DOM attributes, skip functions if told to
27-
if (value==null || (!isComponent && value===false) || (type==='function' && !opts.functions)) return '';
27+
if (value==null || (!isComponent && opts.skipFalseAttributes && value===false) || (type==='function' && !opts.functions)) return '';
2828

2929
let indentChar = typeof opts.pretty==='string' ? opts.pretty : '\t';
3030
if (type!=='string') {
@@ -51,6 +51,7 @@ let defaultOpts = {
5151
xml: false,
5252
functions: true,
5353
functionNames: true,
54+
skipFalseAttributes: true,
5455
pretty: ' '
5556
};
5657

0 commit comments

Comments
 (0)