@@ -44,6 +44,28 @@ function ancestors(first, second) {
44
44
return path ;
45
45
}
46
46
47
+ /**
48
+ * IE8-safe wrapper for `Array.prototype.indexOf()`.
49
+ *
50
+ * @param {Array } array A JavaScript array.
51
+ * @param {* } value A value to search the array for.
52
+ * @return {Number } Returns the array index value of `value`, or `-1` if not present.
53
+ */
54
+ function arraySearch ( array , value ) {
55
+ if ( Array . prototype . indexOf ) {
56
+ return array . indexOf ( value , Number ( arguments [ 2 ] ) || 0 ) ;
57
+ }
58
+ var len = array . length >>> 0 , from = Number ( arguments [ 2 ] ) || 0 ;
59
+ from = ( from < 0 ) ? Math . ceil ( from ) : Math . floor ( from ) ;
60
+
61
+ if ( from < 0 ) from += len ;
62
+
63
+ for ( ; from < len ; from ++ ) {
64
+ if ( from in array && array [ from ] === value ) return from ;
65
+ }
66
+ return - 1 ;
67
+ }
68
+
47
69
/**
48
70
* Merges a set of parameters with all parameters inherited between the common parents of the
49
71
* current state and a given destination state.
@@ -61,7 +83,7 @@ function inheritParams(currentParams, newParams, $current, $to) {
61
83
parentParams = parents [ i ] . params ;
62
84
63
85
for ( var j in parentParams ) {
64
- if ( inheritList . indexOf ( parentParams [ j ] ) >= 0 ) continue ;
86
+ if ( arraySearch ( inheritList , parentParams [ j ] ) >= 0 ) continue ;
65
87
inheritList . push ( parentParams [ j ] ) ;
66
88
inherited [ parentParams [ j ] ] = currentParams [ parentParams [ j ] ] ;
67
89
}
0 commit comments