1010 d3_style_setProperty . call ( this , name , value + "" , priority ) ;
1111 } ;
1212}
13- d3 = { version : "2.9.4 " } ; // semver
13+ d3 = { version : "2.9.5 " } ; // semver
1414function d3_class ( ctor , properties ) {
1515 try {
1616 for ( var key in properties ) {
@@ -449,7 +449,7 @@ function d3_splitter(d) {
449449 return d == null ;
450450}
451451function d3_collapse ( s ) {
452- return s . replace ( / ( ^ \s + ) | ( \s + $ ) / g, "" ) . replace ( / \s + / g, " " ) ;
452+ return s . replace ( / ^ \s + | \s + $ / g, "" ) . replace ( / \s + / g, " " ) ;
453453}
454454d3 . range = function ( start , stop , step ) {
455455 if ( arguments . length < 3 ) {
@@ -1035,6 +1035,7 @@ d3.interpolateTransform = function(a, b) {
10351035 }
10361036
10371037 if ( ra != rb ) {
1038+ if ( ra - rb > 180 ) rb += 360 ; else if ( rb - ra > 180 ) ra += 360 ; // shortest path
10381039 q . push ( { i : s . push ( s . pop ( ) + "rotate(" , null , ")" ) - 2 , x : d3 . interpolateNumber ( ra , rb ) } ) ;
10391040 } else if ( rb ) {
10401041 s . push ( s . pop ( ) + "rotate(" + rb + ")" ) ;
@@ -1626,7 +1627,7 @@ d3_selectionPrototype.attr = function(name, value) {
16261627 : ( name . local ? attrConstantNS : attrConstant ) ) ) ;
16271628} ;
16281629d3_selectionPrototype . classed = function ( name , value ) {
1629- var names = name . split ( d3_selection_classedWhitespace ) ,
1630+ var names = d3_collapse ( name ) . split ( " " ) ,
16301631 n = names . length ,
16311632 i = - 1 ;
16321633 if ( arguments . length > 1 ) {
@@ -1638,8 +1639,6 @@ d3_selectionPrototype.classed = function(name, value) {
16381639 }
16391640} ;
16401641
1641- var d3_selection_classedWhitespace = / \s + / g;
1642-
16431642function d3_selection_classed ( name , value ) {
16441643 var re = new RegExp ( "(^|\\s+)" + d3 . requote ( name ) + "(\\s+|$)" , "g" ) ;
16451644
@@ -2011,14 +2010,19 @@ d3_selectionPrototype.on = function(type, listener, capture) {
20112010 } ) ;
20122011} ;
20132012d3_selectionPrototype . each = function ( callback ) {
2014- for ( var j = - 1 , m = this . length ; ++ j < m ; ) {
2015- for ( var group = this [ j ] , i = - 1 , n = group . length ; ++ i < n ; ) {
2016- var node = group [ i ] ;
2017- if ( node ) callback . call ( node , node . __data__ , i , j ) ;
2013+ return d3_selection_each ( this , function ( node , i , j ) {
2014+ callback . call ( node , node . __data__ , i , j ) ;
2015+ } ) ;
2016+ } ;
2017+
2018+ function d3_selection_each ( groups , callback ) {
2019+ for ( var j = 0 , m = groups . length ; j < m ; j ++ ) {
2020+ for ( var group = groups [ j ] , i = 0 , n = group . length , node ; i < n ; i ++ ) {
2021+ if ( node = group [ i ] ) callback ( node , i , j ) ;
20182022 }
20192023 }
2020- return this ;
2021- } ;
2024+ return groups ;
2025+ }
20222026//
20232027// Note: assigning to the arguments array simultaneously changes the value of
20242028// the corresponding argument!
@@ -2145,12 +2149,12 @@ function d3_transition(groups, id, time) {
21452149 } ;
21462150
21472151 d3 . timer ( function ( elapsed ) {
2148- groups . each ( function ( d , i , j ) {
2152+ return d3_selection_each ( groups , function ( node , i , j ) {
21492153 var tweened = [ ] ,
2150- node = this ,
2151- delay = groups [ j ] [ i ] . delay ,
2152- duration = groups [ j ] [ i ] . duration ,
2153- lock = node . __transition__ || ( node . __transition__ = { active : 0 , count : 0 } ) ;
2154+ delay = node . delay ,
2155+ duration = node . duration ,
2156+ lock = ( node = node . node ) . __transition__ || ( node . __transition__ = { active : 0 , count : 0 } ) ,
2157+ d = node . __data__ ;
21542158
21552159 ++ lock . count ;
21562160
@@ -2196,7 +2200,6 @@ function d3_transition(groups, id, time) {
21962200 return 1 ;
21972201 }
21982202 } ) ;
2199- return 1 ;
22002203 } , 0 , time ) ;
22012204
22022205 return groups ;
@@ -2341,16 +2344,14 @@ d3_transitionPrototype.remove = function() {
23412344 } ) ;
23422345} ;
23432346d3_transitionPrototype . delay = function ( value ) {
2344- var groups = this ;
2345- return groups . each ( typeof value === "function"
2346- ? function ( d , i , j ) { groups [ j ] [ i ] . delay = value . apply ( this , arguments ) | 0 ; }
2347- : ( value = value | 0 , function ( d , i , j ) { groups [ j ] [ i ] . delay = value ; } ) ) ;
2347+ return d3_selection_each ( this , typeof value === "function"
2348+ ? function ( node , i , j ) { node . delay = value . call ( node = node . node , node . __data__ , i , j ) | 0 ; }
2349+ : ( value = value | 0 , function ( node ) { node . delay = value ; } ) ) ;
23482350} ;
23492351d3_transitionPrototype . duration = function ( value ) {
2350- var groups = this ;
2351- return groups . each ( typeof value === "function"
2352- ? function ( d , i , j ) { groups [ j ] [ i ] . duration = Math . max ( 1 , value . apply ( this , arguments ) | 0 ) ; }
2353- : ( value = Math . max ( 1 , value | 0 ) , function ( d , i , j ) { groups [ j ] [ i ] . duration = value ; } ) ) ;
2352+ return d3_selection_each ( this , typeof value === "function"
2353+ ? function ( node , i , j ) { node . duration = Math . max ( 1 , value . call ( node = node . node , node . __data__ , i , j ) | 0 ) ; }
2354+ : ( value = Math . max ( 1 , value | 0 ) , function ( node ) { node . duration = value ; } ) ) ;
23542355} ;
23552356function d3_transition_each ( callback ) {
23562357 var id = d3_transitionId ,
@@ -2360,16 +2361,11 @@ function d3_transition_each(callback) {
23602361
23612362 d3_transitionId = this . id ;
23622363 d3_transitionEase = this . ease ( ) ;
2363- for ( var j = 0 , m = this . length ; j < m ; j ++ ) {
2364- for ( var group = this [ j ] , i = 0 , n = group . length ; i < n ; i ++ ) {
2365- var node = group [ i ] ;
2366- if ( node ) {
2367- d3_transitionDelay = this [ j ] [ i ] . delay ;
2368- d3_transitionDuration = this [ j ] [ i ] . duration ;
2369- callback . call ( node = node . node , node . __data__ , i , j ) ;
2370- }
2371- }
2372- }
2364+ d3_selection_each ( this , function ( node , i , j ) {
2365+ d3_transitionDelay = node . delay ;
2366+ d3_transitionDuration = node . duration ;
2367+ callback . call ( node = node . node , node . __data__ , i , j ) ;
2368+ } ) ;
23732369
23742370 d3_transitionId = id ;
23752371 d3_transitionEase = ease ;
0 commit comments