Make WordPress Core

Changeset 29192


Ignore:
Timestamp:
07/16/2014 06:33:03 PM (10 years ago)
Author:
azaozz
Message:

Autosave: always expose the wp.autosave.local methods, fixes #28924.

File:
1 edited

Legend:

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

    r27713 r29192  
    212212                    result = false;
    213213
    214                 if ( isSuspended ) {
     214                if ( isSuspended || ! hasStorage ) {
    215215                    return false;
    216216                }
     
    400400            }
    401401
    402             // Initialize and run checkPost() on loading the script (before TinyMCE init)
    403402            blog_id = typeof window.autosaveL10n !== 'undefined' && window.autosaveL10n.blog_id;
    404403
    405             // Check if the browser supports sessionStorage and it's not disabled
    406             if ( ! checkStorage() ) {
    407                 return;
    408             }
    409 
     404            // Check if the browser supports sessionStorage and it's not disabled,
     405            // then initialize and run checkPost().
    410406            // Don't run if the post type supports neither 'editor' (textarea#content) nor 'excerpt'.
    411             if ( ! blog_id || ( ! $('#content').length && ! $('#excerpt').length ) ) {
    412                 return;
    413             }
    414 
    415             $document.ready( run );
     407            if ( checkStorage() && blog_id && ( $('#content').length || $('#excerpt').length ) ) {
     408                $document.ready( run );
     409            }
    416410
    417411            return {
Note: See TracChangeset for help on using the changeset viewer.