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. git-svn-id: https://develop.svn.wordpress.org/trunk@25546 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4423693048
commit
6e5e69cb85
|
@ -495,7 +495,6 @@ commentReply = {
|
|||
t.revert();
|
||||
|
||||
r = r.responses[0];
|
||||
c = r.data;
|
||||
id = '#comment-' + r.id;
|
||||
|
||||
if ( 'edit-comment' == t.act )
|
||||
|
@ -513,8 +512,10 @@ commentReply = {
|
|||
}
|
||||
}
|
||||
|
||||
c = $.trim(r.data); // Trim leading whitespaces
|
||||
$(c).hide()
|
||||
$('#replyrow').after(c);
|
||||
|
||||
id = $(id);
|
||||
t.addEvents(id);
|
||||
bg = id.hasClass('unapproved') ? '#FFFFE0' : id.closest('.widefat, .postbox').css('backgroundColor');
|
||||
|
|
|
@ -902,12 +902,16 @@ var wpNavMenu;
|
|||
|
||||
$.post( ajaxurl, params, function(menuMarkup) {
|
||||
var ins = $('#menu-instructions');
|
||||
|
||||
menuMarkup = $.trim( menuMarkup ); // Trim leading whitespaces
|
||||
processMethod(menuMarkup, params);
|
||||
|
||||
// Make it stand out a bit more visually, by adding a fadeIn
|
||||
$( 'li.pending' ).hide().fadeIn('slow');
|
||||
$( '.drag-instructions' ).show();
|
||||
if( ! ins.hasClass( 'menu-instructions-inactive' ) && ins.siblings().length )
|
||||
ins.addClass( 'menu-instructions-inactive' );
|
||||
|
||||
callback();
|
||||
});
|
||||
},
|
||||
|
|
|
@ -208,7 +208,7 @@ wpList = {
|
|||
s.delAfter( rres, _s );
|
||||
}).dequeue();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.ajax( s );
|
||||
return false;
|
||||
|
@ -308,7 +308,7 @@ wpList = {
|
|||
},
|
||||
|
||||
add: function( e, s ) {
|
||||
e = $(e);
|
||||
e = $( $.trim(e) ); // Trim leading whitespaces
|
||||
|
||||
var list = $(this), old = false, _s = { pos: 0, id: 0, oldId: null }, ba, ref, color;
|
||||
|
||||
|
|
Loading…
Reference in New Issue