Skip to content

Commit

Permalink
Removed addEvent support
Browse files Browse the repository at this point in the history
As noted in Automattic#456, IE8 is no longer supported.

Also, undefined is falsey in JavaScript, so the typeof check was unnecessary.
  • Loading branch information
jefferyto committed Apr 15, 2014
1 parent 2d2f66f commit c6ad689
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions js/skip-link-focus-fix.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down

0 comments on commit c6ad689

Please sign in to comment.