WordPress.org

Make WordPress Core

Changeset 25546


Ignore:
Timestamp:
09/21/2013 10:50:09 AM (7 years ago)
Author:
ocean90
Message:

Trim leading whitespace from AJAX responses.

This fixes the warning "$(html) HTML strings must start with '<' character" by jQuery Migrate when adding nav menu items, post custom fields or comment replies.

fixes #23681.

Location:
trunk/src
Files:
3 edited

Legend:

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

    r22396 r25546  
    496496
    497497        r = r.responses[0];
    498         c = r.data;
    499498        id = '#comment-' + r.id;
    500499
     
    514513        }
    515514
     515        c = $.trim(r.data); // Trim leading whitespaces
    516516        $(c).hide()
    517517        $('#replyrow').after(c);
     518
    518519        id = $(id);
    519520        t.addEvents(id);
  • trunk/src/wp-admin/js/nav-menu.js

    r24680 r25546  
    903903            $.post( ajaxurl, params, function(menuMarkup) {
    904904                var ins = $('#menu-instructions');
     905
     906                menuMarkup = $.trim( menuMarkup ); // Trim leading whitespaces
    905907                processMethod(menuMarkup, params);
     908
    906909                // Make it stand out a bit more visually, by adding a fadeIn
    907910                $( 'li.pending' ).hide().fadeIn('slow');
     
    909912                if( ! ins.hasClass( 'menu-instructions-inactive' ) && ins.siblings().length )
    910913                    ins.addClass( 'menu-instructions-inactive' );
     914
    911915                callback();
    912916            });
  • trunk/src/wp-includes/js/wp-lists.js

    r22396 r25546  
    209209                }).dequeue();
    210210            }
    211         }
     211        };
    212212
    213213        $.ajax( s );
     
    309309
    310310    add: function( e, s ) {
    311         e = $(e);
     311        e = $( $.trim(e) ); // Trim leading whitespaces
    312312
    313313        var list = $(this), old = false, _s = { pos: 0, id: 0, oldId: null }, ba, ref, color;
Note: See TracChangeset for help on using the changeset viewer.