Skip to content

Commit 6a32081

Browse files
Murray, ElizabethMurray, Elizabeth
authored andcommitted
Alternative to window.removeEventListener for IE 8
1 parent 26634f7 commit 6a32081

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

modules/stores/URLStore.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,11 @@ var URLStore = {
139139
if (location === 'hash' && window.location.hash === '')
140140
URLStore.replace('/');
141141

142-
if (window.addEventListener) //check for IE 8
142+
if (window.addEventListener) { //check for IE 8
143143
window.addEventListener(changeEvent, notifyChange, false);
144-
else
144+
} else {
145145
window.attachEvent(changeEvent, notifyChange);
146+
}
146147

147148
notifyChange();
148149
},
@@ -156,7 +157,11 @@ var URLStore = {
156157

157158
var changeEvent = CHANGE_EVENTS[_location];
158159

159-
window.removeEventListener(changeEvent, notifyChange, false);
160+
if (window.addEventListener) {
161+
window.removeEventListener(changeEvent, notifyChange, false);
162+
} else {
163+
window.detachEvent(changeEvent, notifyChange);
164+
}
160165

161166
_location = null;
162167
},

0 commit comments

Comments
 (0)