File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ var invariant = require('react/lib/invariant');
3
3
var warning = require ( 'react/lib/warning' ) ;
4
4
5
5
var CHANGE_EVENTS = {
6
- hash : 'hashchange' ,
6
+ hash : ( window . addEventListener ) ? 'hashchange' : 'onhashchange ',
7
7
history : 'popstate'
8
8
} ;
9
9
@@ -139,7 +139,11 @@ var URLStore = {
139
139
if ( location === 'hash' && window . location . hash === '' )
140
140
URLStore . replace ( '/' ) ;
141
141
142
- window . addEventListener ( changeEvent , notifyChange , false ) ;
142
+ if ( window . addEventListener ) { //check for IE 8
143
+ window . addEventListener ( changeEvent , notifyChange , false ) ;
144
+ } else {
145
+ window . attachEvent ( changeEvent , notifyChange ) ;
146
+ }
143
147
144
148
notifyChange ( ) ;
145
149
} ,
@@ -153,7 +157,11 @@ var URLStore = {
153
157
154
158
var changeEvent = CHANGE_EVENTS [ _location ] ;
155
159
156
- window . removeEventListener ( changeEvent , notifyChange , false ) ;
160
+ if ( window . addEventListener ) {
161
+ window . removeEventListener ( changeEvent , notifyChange , false ) ;
162
+ } else {
163
+ window . detachEvent ( changeEvent , notifyChange ) ;
164
+ }
157
165
158
166
_location = null ;
159
167
} ,
You can’t perform that action at this time.
0 commit comments