Changeset 42104
- Timestamp:
- 11/01/2017 09:03:36 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-controls.js
r42048 r42104 5578 5578 } 5579 5579 } ) ); 5580 5581 // Add zero-padding when blurring field. 5582 input.on( 'blur', _.debounce( function() { 5583 if ( ! control.invalidDate ) { 5584 control.populateDateInputs(); 5585 } 5586 } ) ); 5580 5587 } ); 5581 5588 … … 5823 5830 5824 5831 _.each( control.inputElements, function( element, component ) { 5825 if ( 'meridian' === component || parseInt( parsed[ component ], 10 ) !== parseInt( element(), 10 ) ) { 5826 element.set( parsed[ component ] ); 5832 var value = parsed[ component ]; // This will be zero-padded string. 5833 5834 // Set month and meridian regardless of focused state since they are dropdowns. 5835 if ( 'month' === component || 'meridian' === component ) { 5836 5837 // Options in dropdowns are not zero-padded. 5838 value = value.replace( /^0/, '' ); 5839 5840 element.set( value ); 5841 } else { 5842 5843 value = parseInt( value, 10 ); 5844 if ( ! element.element.is( document.activeElement ) ) { 5845 5846 // Populate element with zero-padded value if not focused. 5847 element.set( parsed[ component ] ); 5848 } else if ( value !== parseInt( element(), 10 ) ) { 5849 5850 // Forcibly update the value if its underlying value changed, regardless of zero-padding. 5851 element.set( String( value ) ); 5852 } 5827 5853 } 5828 5854 } );
Note: See TracChangeset
for help on using the changeset viewer.