Make WordPress Core

Changeset 35783


Ignore:
Timestamp:
12/06/2015 06:38:45 PM (9 years ago)
Author:
westonruter
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/customize-preview-widgets.js

    r31471 r35783  
    33    if ( ! wp || ! wp.customize ) { return; }
    44
    5     var api = wp.customize,
    6         OldPreview;
     5    var api = wp.customize;
    76
    87    /**
     
    2120        init: function () {
    2221            var self = this;
     22
     23            this.preview = api.preview;
    2324            this.buildWidgetSelectors();
    2425            this.highlightControls();
     
    105106    };
    106107
    107     /**
    108      * Capture the instance of the Preview since it is private
    109      */
    110     OldPreview = api.Preview;
    111     api.Preview = OldPreview.extend( {
    112         initialize: function( params, options ) {
    113             api.WidgetCustomizerPreview.preview = this;
    114             OldPreview.prototype.initialize.call( this, params, options );
    115         }
    116     } );
    117 
    118108    $(function () {
    119109        var settings = window._wpWidgetCustomizerPreviewSettings;
Note: See TracChangeset for help on using the changeset viewer.