Make WordPress Core

Ticket #27996: Make-postboxes-open-close-if-added-after-DOM.patch

File Make-postboxes-open-close-if-added-after-DOM.patch, 973 bytes (added by johnstonphilip, 9 years ago)

Make postboxes open/close if added after DOM

  • wp-admin/js/postbox.js

    From ac0e560a132899400c0cf25b209bacd7f86285e5 Mon Sep 17 00:00:00 2001
    From: Phil Johnston <support@mintplugins.com>
    Date: Thu, 18 Jun 2015 15:40:37 -0400
    Subject: [PATCH] Make postboxes open/close if added after DOM
    
    If you have a plugin which adds a metabox to the page at runtime, the "handlediv" button which shows/hides the contents of that metabox doesn't work.
    ---
     wp-admin/js/postbox.js | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/wp-admin/js/postbox.js b/wp-admin/js/postbox.js
    index 07e5ed2..560147b 100644
    a b var postboxes; 
    1111
    1212                        self.init(page, args);
    1313
    14                         $('.postbox .hndle, .postbox .handlediv').bind('click.postboxes', function() {
     14                        $( document ).on( '.postbox .hndle, .postbox .handlediv', 'click.postboxes', function() {
    1515                                var p = $(this).parent('.postbox'), id = p.attr('id');
    1616
    1717                                if ( 'dashboard_browser_nag' == id )