From 2b93139fc9c9de7dcab1d64d07260904fa18cad0 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Wed, 15 Oct 2014 05:48:05 +0000 Subject: [PATCH] Twenty Fifteen: clean up skip-link-focus-fix.js, see #29799 git-svn-id: https://develop.svn.wordpress.org/trunk@29897 602fd350-edb4-49c9-b593-d223f7449a82 --- .../themes/twentyfifteen/js/skip-link-focus-fix.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js b/src/wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js index 4df8e61988..5e1a48a101 100644 --- a/src/wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js +++ b/src/wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js @@ -6,16 +6,16 @@ */ ( function() { - var is_webkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1, - is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1, - is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1; + var ua = navigator.userAgent.toLowerCase(); + + if ( ( ua.indexOf( 'webkit' ) > -1 || ua.indexOf( 'opera' ) > -1 || ua.indexOf( 'msie' ) > -1 ) && + document.getElementById && window.addEventListener ) { - 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 ) { - if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) { + if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.nodeName ) ) { element.tabIndex = -1; } @@ -23,4 +23,4 @@ } }, false ); } -} )(); \ No newline at end of file +} )();