B2G/gecko/browser/devtools/markupview/test/browser_inspector_markup_mutation.js
// Strip whitespace from a node and its children.
Strip whitespace from a node and its children.
Strip whitespace from a node and its children .
function stripWhitespace(node)
  {
    node.normalize();
    let iter = node.ownerDocument.createNodeIterator(node, NodeFilter.SHOW_TEXT + NodeFilter.SHOW_COMMENT,
      null, false);
    while ((node = iter.nextNode())) {
      node.nodeValue = node.nodeValue.replace(/\s+/g, '');
      if (node.nodeType == Node.TEXT_NODE &&
        !/[^\s]/.exec(node.nodeValue)) {
        node.parentNode.removeChild(node);
      }
    }
  }
function stripWhitespace ( node ) { node . normalize ( ) ; let iter = node . ownerDocument . createNodeIterator ( node , NodeFilter . SHOW_TEXT + NodeFilter . SHOW_COMMENT , null , false ) ; while ( ( node = iter . nextNode ( ) ) ) { node . nodeValue = node . nodeValue . replace ( / \s+ / g , '' ) ; if ( node . nodeType == Node . TEXT_NODE && ! / [^\s] / . exec ( node . nodeValue ) ) { node . parentNode . removeChild ( node ) ; } } }
Strip whitespace from a node and its children.
Strip whitespace from a node and its children .