diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index e211a41..89a977a 100644
|
|
|
1 | 1 | /* globals _wpCustomizeHeader, _wpCustomizeBackground, _wpMediaViewsL10n, MediaElementPlayer */ |
2 | 2 | (function( exports, $ ){ |
3 | | var Container, focus, api = wp.customize; |
| 3 | var Container, focus, removeContainer, api = wp.customize; |
4 | 4 | |
5 | 5 | /** |
6 | 6 | * @class |
… |
… |
|
2060 | 2060 | // Change objects contained within the main customize object to Settings. |
2061 | 2061 | api.defaultConstructor = api.Setting; |
2062 | 2062 | |
| 2063 | /** |
| 2064 | * Remove a Control, Section, or Panel's container when it is removed from its Values collection. |
| 2065 | * |
| 2066 | * @param {string} id |
| 2067 | * @this {wp.customize.Values} |
| 2068 | */ |
| 2069 | removeContainer = function ( id ) { |
| 2070 | var value; |
| 2071 | if ( this.has( id ) ) { |
| 2072 | value = this.value( id ); |
| 2073 | if ( value.container ) { |
| 2074 | value.container.remove(); |
| 2075 | } |
| 2076 | } |
| 2077 | api.Values.prototype.remove.call( this, id ); |
| 2078 | }; |
| 2079 | |
2063 | 2080 | // Create the collections for Controls, Sections and Panels. |
2064 | | api.control = new api.Values({ defaultConstructor: api.Control }); |
2065 | | api.section = new api.Values({ defaultConstructor: api.Section }); |
2066 | | api.panel = new api.Values({ defaultConstructor: api.Panel }); |
| 2081 | api.control = new api.Values({ defaultConstructor: api.Control, remove: removeContainer }); |
| 2082 | api.section = new api.Values({ defaultConstructor: api.Section, remove: removeContainer }); |
| 2083 | api.panel = new api.Values({ defaultConstructor: api.Panel, remove: removeContainer }); |
2067 | 2084 | |
2068 | 2085 | /** |
2069 | 2086 | * @class |
diff --git src/wp-admin/js/customize-widgets.js src/wp-admin/js/customize-widgets.js
index 729e6a8..d38299d 100644
|
|
|
1566 | 1566 | // Delete any widget form controls for removed widgets |
1567 | 1567 | if ( removedControl && ! wasDraggedToAnotherSidebar ) { |
1568 | 1568 | api.control.remove( removedControl.id ); |
1569 | | removedControl.container.remove(); |
1570 | 1569 | } |
1571 | 1570 | |
1572 | 1571 | // Move widget to inactive widgets sidebar (move it to trash) if has been previously saved |