Sha256: de6773ecb7918ddc8b3f5d828d4856d27e784b3f9cbb0f1448b32ad737f679bc

Contents?: true

Size: 639 Bytes

Versions: 6

Compression:

Stored size: 639 Bytes

Contents

d3_selectionPrototype.sort = function(comparator) {
  comparator = d3_selection_sortComparator.apply(this, arguments);
  for (var j = 0, m = this.length; j < m; j++) {
    for (var group = this[j].sort(comparator), i = 1, n = group.length, prev = group[0]; i < n; i++) {
      var node = group[i];
      if (node) {
        if (prev) prev.parentNode.insertBefore(node, prev.nextSibling);
        prev = node;
      }
    }
  }
  return this;
};

function d3_selection_sortComparator(comparator) {
  if (!arguments.length) comparator = d3.ascending;
  return function(a, b) {
    return comparator(a && a.__data__, b && b.__data__);
  };
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bum-0.0.17 public/d3/src/core/selection-sort.js
bum-0.0.16 public/d3/src/core/selection-sort.js
bum-0.0.15 public/d3/src/core/selection-sort.js
bum-0.0.14 public/d3/src/core/selection-sort.js
bum-0.0.13 public/d3/src/core/selection-sort.js
bum-0.0.12 public/d3/src/core/selection-sort.js