Customize: Skip intercepting non-HTTP(S) links in customizer preview just as jump links are ignored.

Ensures that links with `javascript:`, `mailto:` and other protocols work as expected in the customizer preview.

Props westonruter.
Merges [40064] to the 4.7 branch.
Fixes #39797.

Built from https://develop.svn.wordpress.org/branches/4.7@40096


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2017-02-21 06:56:34 +00:00
parent de7de0a0d6
commit bade579fc3
3 changed files with 6 additions and 7 deletions

View File

@ -145,10 +145,9 @@
return;
}
// Allow internal jump links and JS links to behave normally without preventing default.
isInternalJumpLink = ( '#' === link.attr( 'href' ).substr( 0, 1 ) );
// Allow internal jump links to behave normally without preventing default.
if ( isInternalJumpLink ) {
if ( isInternalJumpLink || ! /^https?:$/.test( link.prop( 'protocol' ) ) ) {
return;
}
@ -334,8 +333,8 @@
return;
}
// Ignore links with href="#" or href="#id".
if ( '#' === $( element ).attr( 'href' ).substr( 0, 1 ) ) {
// Ignore links with href="#", href="#id", or non-HTTP protocols (e.g. javascript: and mailto:).
if ( '#' === $( element ).attr( 'href' ).substr( 0, 1 ) || ! /^https?:$/.test( element.protocol ) ) {
return;
}

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7.3-alpha-40095';
$wp_version = '4.7.3-alpha-40096';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.