Make WordPress Core

Changeset 49710


Ignore:
Timestamp:
11/30/2020 02:29:42 PM (6 years ago)
Author:
azaozz
Message:

Quick/Bulk Edit: Follow up to [49703]. Improve the logic a bit and always return this (the jQuery object) in wpTagsSuggest.

Fixes #51872.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/tags-suggest.js

    r49703 r49710  
    4141                // Do not initialize if the element doesn't exist.
    4242                if ( ! $element.length ) {
    43                         return;
     43                        return this;
    4444                }
    4545
    … …  
    157157
    158158                // Ensure the autocomplete instance exists.
    159                 if ( $element.autocomplete( 'instance' ) ) {
    160                         $element.autocomplete( 'instance' )._renderItem = function( ul, item ) {
    161                                 return $( '<li role="option" id="wp-tags-autocomplete-' + item.id + '">' )
    162                                         .text( item.name )
    163                                         .appendTo( ul );
    164                         };
     159                if ( ! $element.autocomplete( 'instance' ) ) {
     160                        return this;
    165161                }
     162
     163                $element.autocomplete( 'instance' )._renderItem = function( ul, item ) {
     164                        return $( '<li role="option" id="wp-tags-autocomplete-' + item.id + '">' )
     165                                .text( item.name )
     166                                .appendTo( ul );
     167                };
    166168
    167169                $element.attr( {
    … …  
    179181                                $element.autocomplete( 'search' );
    180182                        }
    181                 } )
     183                } );
     184
    182185                // Returns a jQuery object containing the menu element.
    183                 .autocomplete( 'widget' )
     186                $element.autocomplete( 'widget' )
    184187                        .addClass( 'wp-tags-autocomplete' )
    185188                        .attr( 'role', 'listbox' )
Note: See TracChangeset for help on using the changeset viewer.