Customize: Allow control subclasses to add to the `deferred` object before the base class initializes.

Update the `CodeEditorControl`'s `codemirror` deferred to be set before calling the parent class's `initialize` method. Since the `ready` method may be called directly by `initialize` it may be too late to add a new `Deferred` to the control's `deferred` property after calling the base control class's `initialize`.

Amends [41958].
See #41897.


git-svn-id: https://develop.svn.wordpress.org/trunk@41960 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2017-10-21 08:43:36 +00:00
parent 1a8b08418b
commit 931bcb0f7d
1 changed files with 6 additions and 4 deletions

View File

@ -3419,9 +3419,9 @@
control.templateSelector = 'customize-control-' + control.params.type + '-content';
}
control.deferred = {
control.deferred = _.extend( control.deferred || {}, {
embedded: new $.Deferred()
};
} );
control.section = new api.Value();
control.priority = new api.Value();
control.active = new api.Value();
@ -5127,8 +5127,10 @@
*/
initialize: function( id, options ) {
var control = this;
api.Control.prototype.initialize.call( this, id, options );
control.deferred.codemirror = $.Deferred();
control.deferred = _.extend( control.deferred || {}, {
codemirror: $.Deferred()
} );
api.Control.prototype.initialize.call( control, id, options );
},
/**