# Code coverage report for lib/utils/stringifyNode.js

## Statements: 18.18% (2 / 11) Branches: 0% (0 / 7) Functions: 0% (0 / 1) Lines: 18.18% (2 / 11) Ignored: none

All files » lib/utils/ » stringifyNode.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    231

    1
     function _stringifyNode(node) {

      var buffer = "";

      if (node.nodeType === 11) {
        for (var i = 0, n = node.childNodes.length; i < n; i++) {
          buffer += _stringifyNode(node.childNodes[i]);
        }
        return buffer;
      }

      buffer = node.nodeValue || node.outerHTML || "";

      if (node.nodeType === 8) {
        buffer = "<!--" + buffer + "-->";
      }

      return buffer;
    }

    module.exports = _stringifyNode;