Customize: Strip zero padding when setting month to prevent de-selection; add zero-padding for `number` input fields when blurring.
Amends [42042]. See #42373. Fixes #42392. Built from https://develop.svn.wordpress.org/trunk@42104 git-svn-id: http://core.svn.wordpress.org/trunk@41933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a2693fd860
commit
926f2114f0
|
@ -5577,6 +5577,13 @@
|
|||
control.notifications.remove( 'invalid_date' );
|
||||
}
|
||||
} ) );
|
||||
|
||||
// Add zero-padding when blurring field.
|
||||
input.on( 'blur', _.debounce( function() {
|
||||
if ( ! control.invalidDate ) {
|
||||
control.populateDateInputs();
|
||||
}
|
||||
} ) );
|
||||
} );
|
||||
|
||||
control.inputElements.month.bind( control.updateDaysForMonth );
|
||||
|
@ -5822,8 +5829,27 @@
|
|||
}
|
||||
|
||||
_.each( control.inputElements, function( element, component ) {
|
||||
if ( 'meridian' === component || parseInt( parsed[ component ], 10 ) !== parseInt( element(), 10 ) ) {
|
||||
element.set( parsed[ component ] );
|
||||
var value = parsed[ component ]; // This will be zero-padded string.
|
||||
|
||||
// Set month and meridian regardless of focused state since they are dropdowns.
|
||||
if ( 'month' === component || 'meridian' === component ) {
|
||||
|
||||
// Options in dropdowns are not zero-padded.
|
||||
value = value.replace( /^0/, '' );
|
||||
|
||||
element.set( value );
|
||||
} else {
|
||||
|
||||
value = parseInt( value, 10 );
|
||||
if ( ! element.element.is( document.activeElement ) ) {
|
||||
|
||||
// Populate element with zero-padded value if not focused.
|
||||
element.set( parsed[ component ] );
|
||||
} else if ( value !== parseInt( element(), 10 ) ) {
|
||||
|
||||
// Forcibly update the value if its underlying value changed, regardless of zero-padding.
|
||||
element.set( String( value ) );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9-RC1-42056';
|
||||
$wp_version = '4.9-RC1-42104';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue