Make WordPress Core

Changeset 22794


Ignore:
Timestamp:
11/21/2012 09:04:04 PM (12 years ago)
Author:
nacin
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/autosave.js

    r22019 r22794  
    33jQuery(document).ready( function($) {
    44
    5     autosaveLast = $('#post #title').val() + $('#post #content').val();
     5    autosaveLast = ( $('#post #title').val() || '' ) + ( $('#post #content').val() || '' );
    66    autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
    77
     
    3636        } else {
    3737            if ( fullscreen && fullscreen.settings.visible ) {
    38                 title = $('#wp-fullscreen-title').val();
    39                 content = $("#wp_mce_fullscreen").val();
     38                title = $('#wp-fullscreen-title').val() || '';
     39                content = $("#wp_mce_fullscreen").val() || '';
    4040            } else {
    41                 title = $('#post #title').val();
    42                 content = $('#post #content').val();
     41                title = $('#post #title').val() || '';
     42                content = $('#post #content').val() || '';
    4343            }
    4444
Note: See TracChangeset for help on using the changeset viewer.