Twenty Fourteen: Avoid passing an empty string to document.getElementById().

props nabil_kadimi.
fixes #28340.

git-svn-id: https://develop.svn.wordpress.org/trunk@28598 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-05-28 13:35:47 +00:00
parent 5a8b1cfac2
commit 98b4b63e40
1 changed files with 7 additions and 1 deletions

View File

@ -40,7 +40,13 @@
* @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
*/
_window.on( 'hashchange.twentyfourteen', function() {
var element = document.getElementById( location.hash.substring( 1 ) );
var hash = location.hash.substring( 1 ), element;
if ( ! hash ) {
return;
}
element = document.getElementById( hash );
if ( element ) {
if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {