Make WordPress Core

Changeset 28868


Ignore:
Timestamp:
06/27/2014 04:05:07 PM (11 years ago)
Author:
SergeyBiryukov
Message:

Avoid duplication of callbacks in theme browser sidebar each time the Next or Previous button is clicked.

This makes the collapse/expand button work as expected.

fixes #28581.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/theme.js

    r28777 r28868  
    363363    events: {
    364364        'click': themes.isInstall ? 'preview': 'expand',
    365         'click .preview': 'preview',
    366365        'keydown': themes.isInstall ? 'preview': 'expand',
    367366        'touchend': themes.isInstall ? 'preview': 'expand',
     
    488487        }
    489488
    490         // Apend preview
     489        // Append preview
    491490        $( 'div.wrap' ).append( preview.el );
    492491
     
    512511            }
    513512
    514             // Construct a new Preview view.
    515             preview = new themes.view.Preview({
    516                 model: self.current
    517             });
     513            preview.model = self.current;
    518514
    519515            // Render and append.
    520516            preview.render();
    521517            this.setNavButtonsState();
    522             $( 'div.wrap' ).append( preview.el );
    523518            $( '.next-theme' ).focus();
    524519        })
     
    546541            }
    547542
    548             // Construct a new Preview view.
    549             preview = new themes.view.Preview({
    550                 model: self.current
    551             });
     543            preview.model = self.current;
    552544
    553545            // Render and append.
    554546            preview.render();
    555547            this.setNavButtonsState();
    556             $( 'div.wrap' ).append( preview.el );
    557548            $( '.previous-theme' ).focus();
    558549        });
     
    787778        themes.router.navigate( themes.router.baseUrl( '' ) );
    788779        this.trigger( 'preview:close' );
     780        this.undelegateEvents();
    789781        this.unbind();
    790782        return false;
Note: See TracChangeset for help on using the changeset viewer.