Skip to content

Commit 3dad750

Browse files
committed
Fix bug for list-items without children
1 parent f1370eb commit 3dad750

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/handlers/list-item.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var all = require('../all');
1010
function listItem(h, node, parent) {
1111
var children = node.children;
1212
var head = children[0];
13-
var single = (!parent || !parent.loose) && head.children && children.length === 1;
13+
var single = (!parent || !parent.loose) && head && head.children && children.length === 1;
1414
var result = all(h, single ? head : node);
1515
var container;
1616
var props = {};

test/list-item.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,11 @@ test('ListItem', function (t) {
103103
'should support checkboxes in `listItem`s without paragraph'
104104
);
105105

106+
t.deepEqual(
107+
to(u('listItem', [])),
108+
u('element', {tagName: 'li', properties: {}}, []),
109+
'should support `listItem`s without children'
110+
);
111+
106112
t.end();
107113
});

0 commit comments

Comments
 (0)