if (isValidNode(node)) { // how is this helpful?
var processingInstruction = find(function (processingInstruction) {
return processingInstruction.shouldProcessNode(node);
}, processingInstructions);
if (processingInstruction != null) {
var children = reject(function (x) {return x == null || x === false;},
addIndex(map)(function (child, i) {
return traverseDom(child, isValidNode, processingInstructions, i);
}, node.children || []));
if (processingInstruction.replaceChildren) {
return utils.createElement(node, index, node.data, [
processingInstruction.processNode(node, children, index),
]);
}
return processingInstruction.processNode(node, children, index);
} else {
return false;
}
} else {
return false;
}
processingInstructionsalready ignores any node that fails allshouldProcessNode; it seems both confusing and unnecessary to have that extra guard.Below is the code that I take issue with: