Twenty Fourteen: Avoid passing an empty string to document.getElementById().
props nabil_kadimi. fixes #28340. Built from https://develop.svn.wordpress.org/trunk@28598 git-svn-id: http://core.svn.wordpress.org/trunk@28423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
13cbcdd1ad
commit
d59d5a9292
@ -40,7 +40,13 @@
|
|||||||
* @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
|
* @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
|
||||||
*/
|
*/
|
||||||
_window.on( 'hashchange.twentyfourteen', function() {
|
_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 ( element ) {
|
||||||
if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
|
if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user