From 1b2dae466877ca387651064d04ac17a06db9cca9 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 6 Dec 2015 18:38:45 +0000 Subject: [PATCH] Customizer: Re-use public `api.preview` instance in widgets preview instead of unnecessarily capturing in `api.Preview` constructor wrapper. The preview instance is no longer private. Props joshlevinson, westonruter. Fixes #30890. See #30726. git-svn-id: https://develop.svn.wordpress.org/trunk@35783 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/customize-preview-widgets.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/wp-includes/js/customize-preview-widgets.js b/src/wp-includes/js/customize-preview-widgets.js index 92267e88fb..f9828295fc 100644 --- a/src/wp-includes/js/customize-preview-widgets.js +++ b/src/wp-includes/js/customize-preview-widgets.js @@ -2,8 +2,7 @@ if ( ! wp || ! wp.customize ) { return; } - var api = wp.customize, - OldPreview; + var api = wp.customize; /** * wp.customize.WidgetCustomizerPreview @@ -20,6 +19,8 @@ init: function () { var self = this; + + this.preview = api.preview; this.buildWidgetSelectors(); this.highlightControls(); @@ -104,17 +105,6 @@ } }; - /** - * Capture the instance of the Preview since it is private - */ - OldPreview = api.Preview; - api.Preview = OldPreview.extend( { - initialize: function( params, options ) { - api.WidgetCustomizerPreview.preview = this; - OldPreview.prototype.initialize.call( this, params, options ); - } - } ); - $(function () { var settings = window._wpWidgetCustomizerPreviewSettings; if ( ! settings ) {