function clearTextAndStoreValues(node, totalChars, originalNodeValues) {
            var i;
            totalChars = totalChars || 0;

            if (node.nodeValue !== null) {
                var nodeValue = node.nodeValue.replace(/\s+/g, ' ');
                originalNodeValues.values.push(nodeValue);
                node.nodeValue = '';
                totalChars += nodeValue.length;
            }

            for (i = 0; i < node.childNodes.length; i++) {
                totalChars = clearTextAndStoreValues(node.childNodes[i], totalChars, originalNodeValues);
            }

            return totalChars;
        }
Recursively traverse the node tree and set the nodeValue of any text nodes to '', whilst
storing the original value in the newly-created field _originalNodeValue for later use.

@param node
@param totalChars
@returns {number}