Removed addEvent support

As noted in #456, IE8 is no longer supported.

Also, undefined is falsey in JavaScript, so the typeof check was unnecessary.
This commit is contained in:
Jeffery To 2014-04-15 17:40:29 +08:00
parent 2d2f66f9a1
commit c6ad689d89
1 changed files with 2 additions and 3 deletions

View File

@ -3,9 +3,8 @@
is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1,
is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1;
if ( ( is_webkit || is_opera || is_ie ) && 'undefined' !== typeof( document.getElementById ) ) {
var eventMethod = ( window.addEventListener ) ? 'addEventListener' : 'attachEvent';
window[ eventMethod ]( 'hashchange', function() {
if ( ( is_webkit || is_opera || is_ie ) && document.getElementById && window.addEventListener ) {
window.addEventListener( 'hashchange', function() {
var element = document.getElementById( location.hash.substring( 1 ) );
if ( element ) {