import "../selection/select";
import "transition";

d3_transitionPrototype.select = function(selector) {
  var id = this.id,
      ns = this.namespace,
      subgroups = [],
      subgroup,
      subnode,
      node;

  selector = d3_selection_selector(selector);

  for (var j = -1, m = this.length; ++j < m;) {
    subgroups.push(subgroup = []);
    for (var group = this[j], i = -1, n = group.length; ++i < n;) {
      if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i, j))) {
        if ("__data__" in node) subnode.__data__ = node.__data__;
        d3_transitionNode(subnode, i, ns, id, node[ns][id]);
        subgroup.push(subnode);
      } else {
        subgroup.push(null);
      }
    }
  }

  return d3_transition(subgroups, ns, id);
};

@@ -1,16 +1,46 @@
 import 
-%22
+%7B selectionSelectorAll %7D from '
 ../selec
@@ -50,17 +50,20 @@
 n/select
-%22
+All'
 ;%0Aimport
@@ -63,17 +63,18 @@
 %0Aimport 
-%22
+%7B 
 transiti
@@ -79,43 +79,111 @@
 tion
-%22;%0A%0Ad3_transitionPrototype.select =
+Node %7D from './transitionNode/transitionNode';%0Aimport %7B Transition %7D from '../core/Transition';%0A%0Aexport
  fun
@@ -187,16 +187,23 @@
 function
+ select
 (selecto
@@ -225,23 +225,23 @@
  this.id
-,%0A     
+;%0A  var
  ns = th
@@ -252,23 +252,23 @@
 amespace
-,%0A     
+;%0A  var
  subgrou
@@ -275,22 +275,16 @@
 ps = %5B%5D,
-%0A     
  subgrou
@@ -284,23 +284,23 @@
 subgroup
-,%0A     
+;%0A  var
  subnode
@@ -300,22 +300,16 @@
 subnode,
-%0A     
  node;%0A%0A
@@ -321,19 +321,16 @@
 ector = 
-d3_
 selectio
@@ -334,17 +334,19 @@
 tion
-_s
+S
 elector
+All
 (sel
@@ -398,16 +398,17 @@
 ++j %3C m;
+ 
 ) %7B%0A    
@@ -502,16 +502,17 @@
 ++i %3C n;
+ 
 ) %7B%0A    
@@ -625,16 +625,28 @@
 in node)
+ %7B%0A         
  subnode
@@ -680,19 +680,26 @@
         
-d3_
+%7D%0A        
 transiti
@@ -848,12 +848,9 @@
 urn 
-d3_t
+T
 rans
@@ -854,16 +854,21 @@
 ansition
+.from
 (subgrou
@@ -881,10 +881,10 @@
 , id);%0A%7D
-;
+%0A
 %0A

refactor transition.select