diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index 7b9f7b1..e94539f 100644
|
|
|
|
| 142 | 142 | container.container = $( container.params.content ); |
| 143 | 143 | |
| 144 | 144 | container.deferred = { |
| 145 | | ready: new $.Deferred() |
| | 145 | embedded: new $.Deferred() |
| 146 | 146 | }; |
| 147 | 147 | container.priority = new api.Value(); |
| 148 | 148 | container.active = new api.Value(); |
| … |
… |
|
| 155 | 155 | args = $.extend( {}, container.defaultActiveArguments, args ); |
| 156 | 156 | active = ( active && container.isContextuallyActive() ); |
| 157 | 157 | container.onChangeActive( active, args ); |
| 158 | | // @todo trigger 'activated' and 'deactivated' events based on the expanded param? |
| 159 | 158 | }); |
| 160 | 159 | container.expanded.bind( function ( expanded ) { |
| 161 | 160 | var args = container.expandedArgumentsQueue.shift(); |
| 162 | 161 | args = $.extend( {}, container.defaultExpandedArguments, args ); |
| 163 | 162 | container.onChangeExpanded( expanded, args ); |
| 164 | | // @todo trigger 'expanded' and 'collapsed' events based on the expanded param? |
| 165 | 163 | }); |
| 166 | 164 | |
| 167 | 165 | container.attachEvents(); |
| … |
… |
|
| 170 | 168 | |
| 171 | 169 | container.priority.set( isNaN( container.params.priority ) ? 100 : container.params.priority ); |
| 172 | 170 | container.active.set( container.params.active ); |
| 173 | | container.expanded.set( false ); // @todo True if deeplinking? |
| | 171 | container.expanded.set( false ); |
| 174 | 172 | }, |
| 175 | 173 | |
| 176 | 174 | /** |
| … |
… |
|
| 338 | 336 | bubbleChildValueChanges( section, [ 'panel' ] ); |
| 339 | 337 | |
| 340 | 338 | section.embed(); |
| 341 | | section.deferred.ready.done( function () { |
| | 339 | section.deferred.embedded.done( function () { |
| 342 | 340 | section.ready(); |
| 343 | 341 | }); |
| 344 | 342 | }, |
| … |
… |
|
| 356 | 354 | // The panel has been supplied, so wait until the panel object is registered |
| 357 | 355 | api.panel( panelId, function ( panel ) { |
| 358 | 356 | // The panel has been registered, wait for it to become ready/initialized |
| 359 | | panel.deferred.ready.done( function () { |
| | 357 | panel.deferred.embedded.done( function () { |
| 360 | 358 | parentContainer = panel.container.find( 'ul:first' ); |
| 361 | 359 | if ( ! section.container.parent().is( parentContainer ) ) { |
| 362 | 360 | parentContainer.append( section.container ); |
| 363 | 361 | } |
| 364 | | section.deferred.ready.resolve(); // @todo Better to use `embedded` instead of `ready` |
| | 362 | section.deferred.embedded.resolve(); |
| 365 | 363 | }); |
| 366 | 364 | } ); |
| 367 | 365 | } else { |
| … |
… |
|
| 370 | 368 | if ( ! section.container.parent().is( parentContainer ) ) { |
| 371 | 369 | parentContainer.append( section.container ); |
| 372 | 370 | } |
| 373 | | section.deferred.ready.resolve(); |
| | 371 | section.deferred.embedded.resolve(); |
| 374 | 372 | } |
| 375 | 373 | }; |
| 376 | 374 | section.panel.bind( inject ); |
| … |
… |
|
| 479 | 477 | var panel = this; |
| 480 | 478 | Container.prototype.initialize.call( panel, id, options ); |
| 481 | 479 | panel.embed(); |
| 482 | | panel.deferred.ready.done( function () { |
| | 480 | panel.deferred.embedded.done( function () { |
| 483 | 481 | panel.ready(); |
| 484 | 482 | }); |
| 485 | 483 | }, |
| … |
… |
|
| 494 | 492 | if ( ! panel.container.parent().is( parentContainer ) ) { |
| 495 | 493 | parentContainer.append( panel.container ); |
| 496 | 494 | } |
| 497 | | panel.deferred.ready.resolve(); |
| | 495 | panel.deferred.embedded.resolve(); |
| 498 | 496 | }, |
| 499 | 497 | |
| 500 | 498 | /** |
| … |
… |
|
| 676 | 674 | control.container = control.params.content ? $( control.params.content ) : $( control.selector ); |
| 677 | 675 | |
| 678 | 676 | control.deferred = { |
| 679 | | ready: new $.Deferred() |
| | 677 | embedded: new $.Deferred() |
| 680 | 678 | }; |
| 681 | 679 | control.section = new api.Value(); |
| 682 | 680 | control.priority = new api.Value(); |
| … |
… |
|
| 739 | 737 | control.embed(); |
| 740 | 738 | }) ); |
| 741 | 739 | |
| 742 | | control.deferred.ready.done( function () { |
| | 740 | control.deferred.embedded.done( function () { |
| 743 | 741 | control.ready(); |
| 744 | 742 | }); |
| 745 | 743 | }, |
| … |
… |
|
| 760 | 758 | // Wait for the section to be registered |
| 761 | 759 | api.section( sectionId, function ( section ) { |
| 762 | 760 | // Wait for the section to be ready/initialized |
| 763 | | section.deferred.ready.done( function () { |
| | 761 | section.deferred.embedded.done( function () { |
| 764 | 762 | parentContainer = section.container.find( 'ul:first' ); |
| 765 | 763 | if ( ! control.container.parent().is( parentContainer ) ) { |
| 766 | 764 | parentContainer.append( control.container ); |
| 767 | 765 | control.renderContent(); |
| 768 | 766 | } |
| 769 | | control.deferred.ready.resolve(); // @todo Better to use `embedded` instead of `ready` |
| | 767 | control.deferred.embedded.resolve(); |
| 770 | 768 | }); |
| 771 | 769 | }); |
| 772 | 770 | }; |
| … |
… |
|
| 1930 | 1928 | if ( id && api[ type ]( id ) ) { |
| 1931 | 1929 | instance = api[ type ]( id ); |
| 1932 | 1930 | // Wait until the element is embedded in the DOM |
| 1933 | | instance.deferred.ready.done( function () { |
| | 1931 | instance.deferred.embedded.done( function () { |
| 1934 | 1932 | // Wait until the preview has activated and so active panels, sections, controls have been set |
| 1935 | 1933 | api.previewer.deferred.active.done( function () { |
| 1936 | 1934 | instance.focus(); |