Skip to content

Commit db13dab

Browse files
committed
Fix error on invalid elements, roots
Closes rehypejs/rehype-raw#7.
1 parent 33afc43 commit db13dab

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,14 @@ function wrap(tree, file) {
100100
}
101101

102102
function all(nodes) {
103-
var length = nodes.length;
103+
var length = 0;
104104
var index = -1;
105105

106+
/* istanbul ignore else - invalid nodes, see wooorm/rehype-raw#7. */
107+
if (nodes) {
108+
length = nodes.length;
109+
}
110+
106111
while (++index < length) {
107112
one(nodes[index]);
108113
}

0 commit comments

Comments
 (0)