From 931bcb0f7ddab47b9e90fbb046d920f3f56f03a7 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sat, 21 Oct 2017 08:43:36 +0000 Subject: [PATCH] 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 --- src/wp-admin/js/customize-controls.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index 9006865066..83db9651ca 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -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 ); }, /**