From ca92ca385e87e9c0074b0dd2c9bd558f1ba2ea2b Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Wed, 15 Oct 2014 05:49:19 +0000 Subject: [PATCH] Twenty Fifteen: clean up skip-link-focus-fix.js, see #29799 Built from https://develop.svn.wordpress.org/trunk@29897 git-svn-id: http://core.svn.wordpress.org/trunk@29652 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../themes/twentyfifteen/js/skip-link-focus-fix.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js b/wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js index 4df8e61988..5e1a48a101 100644 --- a/wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js +++ b/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 +} )();