declare function as const and added Node.DOCUMENT_NODE

This commit is contained in:
Schwörer Mike 2016-11-30 12:23:19 +01:00
parent befb89ba76
commit d5f84abb3b

View file

@ -330,12 +330,13 @@ var Extract = {
}
var serializer = new XMLSerializer();
var nodeToString = function(node) {
const nodeToString = function(node) {
const { nodeType, value, wholeText, data } = node;
switch (nodeType) {
case Node.ELEMENT_NODE: return serializer.serializeToString(node);
case Node.ATTRIBUTE_NODE: return value;
case Node.COMMENT_NODE: return data;
case Node.DOCUMENT_NODE: return serializer.serializeToString(node);
default: throw new Error(`Unknown Node Type: ${nodeType}`);
}
}