[wp-trac] [WordPress Trac] #37270: Improve handling of active state for dynamically-created controls/sections/panels

WordPress Trac noreply at wordpress.org
Mon Aug 15 15:48:01 UTC 2016


#37270: Improve handling of active state for dynamically-created
controls/sections/panels
--------------------------+-----------------------------
 Reporter:  westonruter   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Customize     |     Version:  4.0
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  javascript
--------------------------+-----------------------------

Comment (by sayedwp):

 @westonruter Can we do it more simply like this


 {{{
 var isDynamicallyCreated = _.isUndefined( wp.customize.settings[ type +
 's' ][ id ] ),
       active = ! _.isUndefined( activeConstructs[ id ] );

 if ( ! isDynamicallyCreated ) {
    if ( active ) {
      construct.activate();
    } else {
      construct.deactivate();
    }
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37270#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list