forked from mirror/_s
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:
parent
2d2f66f9a1
commit
c6ad689d89
|
@ -3,9 +3,8 @@
|
||||||
is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1,
|
is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1,
|
||||||
is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1;
|
is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1;
|
||||||
|
|
||||||
if ( ( is_webkit || is_opera || is_ie ) && 'undefined' !== typeof( document.getElementById ) ) {
|
if ( ( is_webkit || is_opera || is_ie ) && document.getElementById && window.addEventListener ) {
|
||||||
var eventMethod = ( window.addEventListener ) ? 'addEventListener' : 'attachEvent';
|
window.addEventListener( 'hashchange', function() {
|
||||||
window[ eventMethod ]( 'hashchange', function() {
|
|
||||||
var element = document.getElementById( location.hash.substring( 1 ) );
|
var element = document.getElementById( location.hash.substring( 1 ) );
|
||||||
|
|
||||||
if ( element ) {
|
if ( element ) {
|
||||||
|
|
Reference in New Issue