function mergeAdjacentWhitespace(node) {
    var i = node.content.length - 1;
    while (i-- > 0) {
      if (node.get(i).is('space') &&
          node.get(i + 1) && node.get(i + 1).is('space')) {
        node.get(i).content += node.get(i + 1).content;
        node.removeChild(i + 1);
      }
    }
  }
function mergeAdjacentWhitespace(node) {
    var i = node.content.length - 1;
    while (i-- > 0) {
      if (node.get(i).is('space') &&
          node.get(i + 1) && node.get(i + 1).is('space')) {
        node.get(i).content += node.get(i + 1).content;
        node.removeChild(i + 1);
      }
    }
  }
function mergeAdjacentWhitespace ( node ) { var i = node . content . length - 1 ; while ( i -- > 0 ) { if ( node . get ( i ) . is ( 'space' ) && node . get ( i + 1 ) && node . get ( i + 1 ) . is ( 'space' ) ) { node . get ( i ) . content += node . get ( i + 1 ) . content ; node . removeChild ( i + 1 ) ; } } }
Removing ruleset nodes from tree may result in two adjacent whitespace
nodes which is not correct AST:
[space, ruleset, space] => [space, space]
To ensure correctness of further processing we should merge such nodes
into one:
[space, space] => [space]
Removing ruleset nodes from tree may result in two adjacent whitespace nodes which is not correct AST : [ space ruleset space ] = > [ space space ] To ensure correctness of further processing we should merge such nodes into one : [ space space ] = > [ space ]