WordPress.org

Make WordPress Core

Ticket #36263: 36263.diff

File 36263.diff, 628 bytes (added by yale01, 3 years ago)

improved array keys comparison

  • wp-includes/js/shortcode.js

     
    216216                        this.attrs = wp.shortcode.attrs( attrs );
    217217
    218218                // Identify a correctly formatted `attrs` object.
    219                 } else if ( _.isEqual( _.keys( attrs ), [ 'named', 'numeric' ] ) ) {
    220                         this.attrs = attrs;
     219                } else if ( _.difference( _.keys( attrs ), [ 'named', 'numeric' ] ).length === 0 ) {
     220                        this.attrs = _.defaults( attrs, { named : {}, numeric : [] } );
    221221
    222222                // Handle a flat object of attributes.
    223223                } else {