File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11function d3_array ( psuedoarray ) {
22 return Array . prototype . slice . call ( psuedoarray ) ;
33}
4+
5+ // Adapted from Sizzle.js:
6+ //
7+ // Perform a simple check to determine if the browser is capable of
8+ // converting a NodeList to an array using builtin methods.
9+ // Also verifies that the returned array holds DOM nodes
10+ // (which is not the case in the Blackberry browser)
11+ try {
12+ Array . prototype . slice . call ( document . documentElement . childNodes , 0 ) [ 0 ] . nodeType ;
13+ // Provide a fallback method if it does not work
14+ } catch ( e ) {
15+ d3_array = function ( array ) {
16+ var i = 0 ,
17+ ret = [ ] ;
18+
19+ if ( toString . call ( array ) === "[object Array]" ) {
20+ Array . prototype . push . apply ( ret , array ) ;
21+ } else {
22+ if ( typeof array . length === "number" ) {
23+ for ( var l = array . length ; i < l ; i ++ ) {
24+ ret . push ( array [ i ] ) ;
25+ }
26+ } else {
27+ for ( ; array [ i ] ; i ++ ) {
28+ ret . push ( array [ i ] ) ;
29+ }
30+ }
31+ }
32+ return ret ;
33+ } ;
34+ }
You can’t perform that action at this time.
0 commit comments