Autosave: Properly convert undefined fields to empty strings. This bug could cause issues if a post type didn't support the title and/or editor. see #22491.

git-svn-id: http://core.svn.wordpress.org/trunk@22794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-21 21:04:04 +00:00
parent f328a74f77
commit a962e6f58b

View File

@ -2,7 +2,7 @@ var autosave, autosaveLast = '', autosavePeriodical, autosaveOldMessage = '', au
jQuery(document).ready( function($) {
autosaveLast = $('#post #title').val() + $('#post #content').val();
autosaveLast = ( $('#post #title').val() || '' ) + ( $('#post #content').val() || '' );
autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
//Disable autosave after the form has been submitted
@ -35,11 +35,11 @@ jQuery(document).ready( function($) {
return autosaveL10n.saveAlert;
} else {
if ( fullscreen && fullscreen.settings.visible ) {
title = $('#wp-fullscreen-title').val();
content = $("#wp_mce_fullscreen").val();
title = $('#wp-fullscreen-title').val() || '';
content = $("#wp_mce_fullscreen").val() || '';
} else {
title = $('#post #title').val();
content = $('#post #content').val();
title = $('#post #title').val() || '';
content = $('#post #content').val() || '';
}
if ( ( title || content ) && title + content != autosaveLast )