Add or remove HTML class with selective refresh?
Yes. This can be accomplished by creating a custom selective refresh Partial type, and overriding the refresh method in the JavaScript class. Here’s the relevant JavaScript which should get enqueued in the Customizer preview, with customize-selective-refresh as its script dependency: wp.customize.selectiveRefresh.partialConstructor.body_class = wp.customize.selectiveRefresh.Partial.extend({ /** * Class name choices. * * This is populated in PHP … Read more