example-d3/webworker.js
/** The merge in merge-sort.*/
The merge in merge-sort.
The merge in merge - sort .
function mergeNodeLists(x, y) {
    var a, b, aanc, banc, r = [];
    if ('object' !== typeof x)
      throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,
                               'Invalid LHS for | operator ' +
                               '(expected node-set): ' + x);
    if ('object' !== typeof y)
      throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,
                               'Invalid LHS for | operator ' +
                               '(expected node-set): ' + y);
    while (true) {
      if (null == a) {
        a = x.shift();
        if (null != a)
          aanc = addressVector(a);
      }
      if (null == b) {
        b = y.shift();
        if (null != b)
          banc = addressVector(b);
      }
      if (null == a || null == b) break;
      var c = addressComparator(aanc, banc);
      if (c < 0) {
        r.push(a);
        a = null;
        aanc = null;
      } else if (c > 0) {
        r.push(b);
        b = null;
        banc = null;
      } else if (a.nodeName < b.nodeName) {  
        r.push(a);
        a = null;
        aanc = null;
      } else if (a.nodeName > b.nodeName) {  
        r.push(b);
        b = null;
        banc = null;
      } else if (a !== b) {
        r.push(b);
        b = null;
        banc = null;
      } else {
        console.assert(a === b, c);
        b = null;
        banc = null;
      }
    }
    while (a) {
      r.push(a);
      a = x.shift();
    }
    while (b) {
      r.push(b);
      b = y.shift();
    }
    return r;
  }
function mergeNodeLists ( x , y ) { var a , b , aanc , banc , r = [ ] ; if ( 'object' !== typeof x ) throw new XPathException ( XPathException . INVALID_EXPRESSION_ERR , 'Invalid LHS for | operator ' + '(expected node-set): ' + x ) ; if ( 'object' !== typeof y ) throw new XPathException ( XPathException . INVALID_EXPRESSION_ERR , 'Invalid LHS for | operator ' + '(expected node-set): ' + y ) ; while ( true ) { if ( null == a ) { a = x . shift ( ) ; if ( null != a ) aanc = addressVector ( a ) ; } if ( null == b ) { b = y . shift ( ) ; if ( null != b ) banc = addressVector ( b ) ; } if ( null == a || null == b ) break ; var c = addressComparator ( aanc , banc ) ; if ( c < 0 ) { r . push ( a ) ; a = null ; aanc = null ; } else if ( c > 0 ) { r . push ( b ) ; b = null ; banc = null ; } else if ( a . nodeName < b . nodeName ) { r . push ( a ) ; a = null ; aanc = null ; } else if ( a . nodeName > b . nodeName ) { r . push ( b ) ; b = null ; banc = null ; } else if ( a !== b ) { r . push ( b ) ; b = null ; banc = null ; } else { console . assert ( a === b , c ) ; b = null ; banc = null ; } } while ( a ) { r . push ( a ) ; a = x . shift ( ) ; } while ( b ) { r . push ( b ) ; b = y . shift ( ) ; } return r ; }
The merge in merge-sort.
The merge in merge - sort .
// attributes // attributes // choose b arbitrarily // just skip b without pushing it.