Skip to content

Commit

Permalink
bugfix ie8
Browse files Browse the repository at this point in the history
  • Loading branch information
glassesfactory committed Jan 21, 2014
1 parent cc79490 commit 13e6fa2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/coffee/kazitori.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class Kazitori
@.history = win.history
docMode = document.documentMode
@isIE = win.navigator.userAgent.toLowerCase().indexOf('msie') != -1
@isOldIE = @isIE and (!docMode||docMode < 7)
@isOldIE = @isIE and (!docMode||docMode < 9)
@_dispatcher = new EventDispatcher()
@.handlers = []
@.beforeHandlers = []
Expand Down Expand Up @@ -1082,11 +1082,15 @@ class Kazitori
win.addEventListener 'popstate', @observeURLHandler
if @._wantChangeHash is true and not @.isOldIE
win.addEventListener 'hashchange', @observeURLHandler
else if @._wantChangeHash is true
win.attachEvent 'onhashchange', @observeURLHandler

_removePopStateHandler:()->
win = window
win.removeEventListener 'popstate', @observeURLHandler
win.removeEventListener 'hashchange', @observeURLHandler
if @.isOldIE
win.detachEvent 'onhashchange', @observeURLHandler


#==============================================
Expand Down
2 changes: 1 addition & 1 deletion src/js/kai.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/js/kazitori.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ Kazitori = (function() {
}
docMode = document.documentMode;
this.isIE = win.navigator.userAgent.toLowerCase().indexOf('msie') !== -1;
this.isOldIE = this.isIE && (!docMode || docMode < 7);
this.isOldIE = this.isIE && (!docMode || docMode < 9);
this._dispatcher = new EventDispatcher();
this.handlers = [];
this.beforeHandlers = [];
Expand Down Expand Up @@ -1248,14 +1248,19 @@ Kazitori = (function() {
}
if (this._wantChangeHash === true && !this.isOldIE) {
return win.addEventListener('hashchange', this.observeURLHandler);
} else if (this._wantChangeHash === true) {
return win.attachEvent('onhashchange', this.observeURLHandler);
}
};

Kazitori.prototype._removePopStateHandler = function() {
var win;
win = window;
win.removeEventListener('popstate', this.observeURLHandler);
return win.removeEventListener('hashchange', this.observeURLHandler);
win.removeEventListener('hashchange', this.observeURLHandler);
if (this.isOldIE) {
return win.detachEvent('onhashchange', this.observeURLHandler);
}
};

Kazitori.prototype._slice = Array.prototype.slice;
Expand Down
Loading

0 comments on commit 13e6fa2

Please sign in to comment.