Make WordPress Core

Changeset 20798


Ignore:
Timestamp:
05/15/2012 10:14:46 PM (14 years ago)
Author:
koopersmith
Message:

Theme Customizer: Clarify wp.customize.Values API by removing Values.pass and all methods that passed through to the wp.customize.Value objects it contained. see #19910.

Location:
trunk/wp-includes/js
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/customize-base.dev.js

    r20797 r20798  
    292292                },
    293293
     294                create: function( id ) {
     295                        return this.add( id, new this.defaultConstructor( api.Class.applicator, slice.call( arguments, 1 ) ) );
     296                },
     297
    294298                get: function() {
    295299                        var result = {};
    296 
    297                         if ( arguments.length )
    298                                 return this.pass( 'get', arguments );
    299300
    300301                        $.each( this._value, function( key, obj ) {
     
    304305                },
    305306
    306                 set: function( id ) {
    307                         if ( this.has( id ) )
    308                                 return this.pass( 'set', arguments );
    309 
    310                         return this.add( id, new this.defaultConstructor( api.Class.applicator, slice.call( arguments, 1 ) ) );
    311                 },
    312 
    313307                remove: function( id ) {
    314308                        delete this._value[ id ];
    315309                        delete this._deferreds[ id ];
    316                 },
    317 
    318                 pass: function( fn, args ) {
    319                         var id, value;
    320 
    321                         args = slice.call( args );
    322                         id   = args.shift();
    323 
    324                         if ( ! this.has( id ) )
    325                                 return;
    326 
    327                         value = this.value( id );
    328                         return value[ fn ].apply( value, args );
    329310                },
    330311
     
    375356        });
    376357
    377         $.each( [ 'bind', 'unbind', 'link', 'unlink', 'sync', 'unsync', 'setter', 'resetSetter' ], function( i, method ) {
    378                 api.Values.prototype[ method ] = function() {
    379                         return this.pass( method, arguments );
    380                 };
    381         });
    382 
    383 
    384358        /* =====================================================================
    385359         * An observable value that syncs with an element.
  • trunk/wp-includes/js/customize-controls.dev.js

    r20761 r20798  
    436436
    437437                $.each( api.settings.settings, function( id, data ) {
    438                         api.set( id, id, data.value, {
     438                        api.create( id, id, data.value, {
    439439                                transport: data.transport,
    440440                                previewer: previewer
     
    527527                        control.element.bind( function( to ) {
    528528                                if ( ! to )
    529                                         last = api.get( 'header_textcolor' );
     529                                        last = api( 'header_textcolor' ).get();
    530530
    531531                                control.setting.set( to ? last : 'blank' );
  • trunk/wp-includes/js/customize-preview.dev.js

    r20745 r20798  
    6666
    6767                $.each( api.settings.values, function( id, value ) {
    68                         api.set( id, value );
     68                        api.create( id, value );
    6969                });
    7070
    7171                preview.bind( 'setting', function( args ) {
    72                         api.set.apply( api, args );
     72                        var value = api( args.shift() );
     73                        if ( value )
     74                                value.apply( value, args );
    7375                });
    7476
Note: See TracChangeset for help on using the changeset viewer.