[wp-trac] [WordPress Trac] #35855: Let selective refresh component be required but be opt-in for sidebars/widgets (for now)

WordPress Trac noreply at wordpress.org
Tue Mar 15 20:15:49 UTC 2016


#35855: Let selective refresh component be required but be opt-in for
sidebars/widgets (for now)
----------------------------+--------------------------
 Reporter:  DrewAPicture    |       Owner:  westonruter
     Type:  task (blessed)  |      Status:  accepted
 Priority:  normal          |   Milestone:  4.5
Component:  Customize       |     Version:  trunk
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+--------------------------

Comment (by westonruter):

 Here is [https://github.com/xwp/wp-jetpack/blob/feature/selective-refresh-
 widget-support/modules/widgets/contact-info/contact-info-map.js#L35-L48
 another example] for how to implement selective refresh for a widget, here
 for Jetpack's Contact Info widget:

 {{{#!js
 wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function(
 placement ) {
         if ( placement.partial.widgetId &&
 /^widget_contact_info-\d+$/.test( placement.partial.widgetId ) ) {
                 setupContactMaps( placement.container );
         }
 } );
 }}}

 Note the `setupContactMaps` function here gets called at jQuery `ready`
 and sets up the entire `document.body`, but then here you can see the
 plugin code allows the root element to be passed in to scope the re-
 initialization logic.

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


More information about the wp-trac mailing list