Customizer: Trim whitespace from custom link URLs.

This complements a similar fix for the Menus screen in [45655].

Props donmhico, audrasjb.
Fixes #47888. See #47723.
Built from https://develop.svn.wordpress.org/trunk@45869


git-svn-id: http://core.svn.wordpress.org/trunk@45680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-08-21 00:27:57 +00:00
parent 6b9ab1c5c5
commit f8fb93cd0d
5 changed files with 7 additions and 6 deletions

View File

@ -544,6 +544,7 @@
var menuItem,
itemName = $( '#custom-menu-item-name' ),
itemUrl = $( '#custom-menu-item-url' ),
url = itemUrl.val().trim(),
urlRegex;
if ( ! this.currentMenuControl ) {
@ -567,14 +568,14 @@
if ( '' === itemName.val() ) {
itemName.addClass( 'invalid' );
return;
} else if ( ! urlRegex.test( itemUrl.val() ) ) {
} else if ( ! urlRegex.test( url ) ) {
itemUrl.addClass( 'invalid' );
return;
}
menuItem = {
'title': itemName.val(),
'url': itemUrl.val(),
'url': url,
'type': 'custom',
'type_label': api.Menus.data.l10n.custom_label,
'object': 'custom'

File diff suppressed because one or more lines are too long

View File

@ -944,7 +944,7 @@
},
addCustomLink : function( processMethod ) {
var url = $('#custom-menu-item-url').val(),
var url = $('#custom-menu-item-url').val().trim(),
label = $('#custom-menu-item-name').val();
processMethod = processMethod || api.addMenuItemToBottom;

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45867';
$wp_version = '5.3-alpha-45869';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.