]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/wp-util.js
Wordpress 4.6-scripts
[autoinstalls/wordpress.git] / wp-includes / js / wp-util.js
index 84cb5510bbdece7103385d6bb98b3498bc4fbb49..527441dda9504c1c1eeb394117e23b164eb77620 100644 (file)
@@ -30,7 +30,7 @@ window.wp = window.wp || {};
                        };
 
                return function ( data ) {
-                       compiled = compiled || _.template( $( '#tmpl-' + id ).html(), null, options );
+                       compiled = compiled || _.template( $( '#tmpl-' + id ).html(),  options );
                        return compiled( data );
                };
        });
@@ -48,8 +48,9 @@ window.wp = window.wp || {};
                 *
                 * Sends a POST request to WordPress.
                 *
-                * @param  {string} action The slug of the action to fire in WordPress.
-                * @param  {object} data   The data to populate $_POST with.
+                * @param  {(string|object)} action  The slug of the action to fire in WordPress or options passed
+                *                                   to jQuery.ajax.
+                * @param  {object=}         data    Optional. The data to populate $_POST with.
                 * @return {$.promise}     A jQuery promise that represents the request,
                 *                         decorated with an abort() method.
                 */
@@ -64,8 +65,9 @@ window.wp = window.wp || {};
                 *
                 * Sends a POST request to WordPress.
                 *
-                * @param  {string} action  The slug of the action to fire in WordPress.
-                * @param  {object} options The options passed to jQuery.ajax.
+                * @param  {(string|object)} action  The slug of the action to fire in WordPress or options passed
+                *                                   to jQuery.ajax.
+                * @param  {object=}         options Optional. The options passed to jQuery.ajax.
                 * @return {$.promise}      A jQuery promise that represents the request,
                 *                          decorated with an abort() method.
                 */
@@ -96,8 +98,7 @@ window.wp = window.wp || {};
 
                                // Use with PHP's wp_send_json_success() and wp_send_json_error()
                                deferred.jqXHR = $.ajax( options ).done( function( response ) {
-                                       // Treat a response of `1` as successful for backwards
-                                       // compatibility with existing handlers.
+                                       // Treat a response of 1 as successful for backward compatibility with existing handlers.
                                        if ( response === '1' || response === 1 )
                                                response = { success: true };