forked from mikenikles/html-to-react
-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
processingInstructions already ignores any node that fails all shouldProcessNode; it seems both confusing and unnecessary to have that extra guard.
Below is the code that I take issue with:
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;
}
Metadata
Metadata
Assignees
Labels
No labels