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:
Dominik Schilling (ocean90) 2013-09-21 10:50:09 +00:00
parent 4423693048
commit 6e5e69cb85
3 changed files with 8 additions and 3 deletions

View File

@ -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');

View File

@ -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();
});
},

View File

@ -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;