<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[42416] trunk/src/wp-includes/js/customize-preview-widgets.js: Docs: Improve JSDoc for `customize-preview-widgets.js`.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/42416">42416</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/42416","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>atimmer</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2017-12-21 15:11:25 +0000 (Thu, 21 Dec 2017)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Docs: Improve JSDoc for `customize-preview-widgets.js`.

Props ireneyoast, andizer, robinvandervliet, boblinthorst.
Fixes <a href="https://core.trac.wordpress.org/ticket/42954">#42954</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesjscustomizepreviewwidgetsjs">trunk/src/wp-includes/js/customize-preview-widgets.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesjscustomizepreviewwidgetsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/customize-preview-widgets.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/customize-preview-widgets.js     2017-12-21 14:26:17 UTC (rev 42415)
+++ trunk/src/wp-includes/js/customize-preview-widgets.js       2017-12-21 15:11:25 UTC (rev 42416)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,6 +1,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /* global _wpWidgetCustomizerPreviewSettings */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/** @namespace wp.customize.widgetsPreview */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Handles the initialization, refreshing and rendering of widget partials and sidebar widgets.
+ *
+ * @since 4.5.0
+ *
+ * @namespace wp.customize.widgetsPreview
+ *
+ * @param {jQuery} $   The jQuery object.
+ * @param {Object} _   The utilities library.
+ * @param {Object} wp  Current WordPress environment instance.
+ * @param {Object} api Information from the API.
+ *
+ * @returns {Object} Widget-related variables.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> wp.customize.widgetsPreview = wp.customize.WidgetCustomizerPreview = (function( $, _, wp, api ) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        var self;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,9 +32,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Init widgets preview.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * Initializes the widgets preview.
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 4.5.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         *
+        * @memberOf wp.customize.widgetsPreview
+        *
+        * @returns {void}
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        self.init = function() {
</span><span class="cx" style="display: block; padding: 0 10px">                var self = this;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -59,25 +76,23 @@
</span><span class="cx" style="display: block; padding: 0 10px">                } );
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        /**
-        * Partial representing a widget instance.
-        *
-        * @memberOf wp.customize.widgetsPreview
-        * @alias wp.customize.widgetsPreview.WidgetPartial
-        *
-        * @class
-        * @augments wp.customize.selectiveRefresh.Partial
-        * @since 4.5.0
-        */
</del><span class="cx" style="display: block; padding: 0 10px">         self.WidgetPartial = api.selectiveRefresh.Partial.extend(/** @lends wp.customize.widgetsPreview.WidgetPartial.prototype */{
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Constructor.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * Represents a partial widget instance.
</ins><span class="cx" style="display: block; padding: 0 10px">                  *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 4.5.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @param {string} id - Partial ID.
-                * @param {Object} options
-                * @param {Object} options.params
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          *
+                * @constructs
+                * @augments wp.customize.selectiveRefresh.Partial
+                *
+                * @alias wp.customize.widgetsPreview.WidgetPartial
+                * @memberOf wp.customize.widgetsPreview
+                *
+                * @param {string} id             The partial's ID.
+                * @param {Object} options        Options used to initialize the partial's
+                *                                instance.
+                * @param {Object} options.params The options parameters.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                initialize: function( id, options ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        var partial = this, matches;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -101,9 +116,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Refresh widget partial.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * Refreshes the widget partial.
</ins><span class="cx" style="display: block; padding: 0 10px">                  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @returns {Promise}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @since 4.5.0
+                *
+                * @returns {Promise|void} Either a promise postponing the refresh, or void.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                refresh: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        var partial = this, refreshDeferred;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -118,10 +135,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Send widget-updated message to parent so spinner will get removed from widget control.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * Sends the widget-updated message to the parent so the spinner will get
+                * removed from the widget control.
</ins><span class="cx" style="display: block; padding: 0 10px">                  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @inheritdoc
-                * @param {wp.customize.selectiveRefresh.Placement} placement
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @inheritDoc
+                * @param {wp.customize.selectiveRefresh.Placement} placement The placement
+                *                                                            function.
+                *
+                * @returns {void}
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                renderContent: function( placement ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        var partial = this;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -132,25 +153,22 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">        });
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        /**
-        * Partial representing a widget area.
-        *
-        * @memberOf wp.customize.widgetsPreview
-        * @alias wp.customize.widgetsPreview.SidebarPartial
-        *
-        * @class
-        * @augments wp.customize.selectiveRefresh.Partial
-        * @since 4.5.0
-        */
</del><span class="cx" style="display: block; padding: 0 10px">         self.SidebarPartial = api.selectiveRefresh.Partial.extend(/** @lends wp.customize.widgetsPreview.SidebarPartial.prototype */{
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Constructor.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * Represents a partial widget area.
</ins><span class="cx" style="display: block; padding: 0 10px">                  *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 4.5.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @param {string} id - Partial ID.
-                * @param {Object} options
-                * @param {Object} options.params
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          *
+                * @class
+                * @augments wp.customize.selectiveRefresh.Partial
+                *
+                * @memberOf wp.customize.widgetsPreview
+                * @alias wp.customize.widgetsPreview.SidebarPartial
+                *
+                * @param {string} id             The partial's ID.
+                * @param {Object} options        Options used to initialize the partial's instance.
+                * @param {Object} options.params The options parameters.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                initialize: function( id, options ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        var partial = this, matches;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -179,9 +197,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Set up the partial.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * Sets up the partial.
</ins><span class="cx" style="display: block; padding: 0 10px">                  *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 4.5.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 *
+                * @returns {void}
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                ready: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        var sidebarPartial = this;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -220,12 +240,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Get the before/after boundary nodes for all instances of this sidebar (usually one).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * Gets the before/after boundary nodes for all instances of this sidebar
+                * (usually one).
</ins><span class="cx" style="display: block; padding: 0 10px">                  *
</span><span class="cx" style="display: block; padding: 0 10px">                 * Note that TreeWalker is not implemented in IE8.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 4.5.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 *
</ins><span class="cx" style="display: block; padding: 0 10px">                  * @returns {Array.<{before: Comment, after: Comment, instanceNumber: number}>}
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 *          An array with an object for each sidebar instance, containing the
+                *          node before and after the sidebar instance and its instance number.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                findDynamicSidebarBoundaryNodes: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        var partial = this, regExp, boundaryNodes = {}, recursiveCommentTraversal;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -261,10 +285,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Get the placements for this partial.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * Gets the placements for this partial.
</ins><span class="cx" style="display: block; padding: 0 10px">                  *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 4.5.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @returns {Array}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          *
+                * @returns {Array} An array containing placement objects for each of the
+                *                  dynamic sidebar boundary nodes.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                placements: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        var partial = this;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -286,7 +312,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 4.5.0
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @returns {Array}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @throws {Error} If there's no settingId.
+                * @throws {Error} If the setting doesn't exist in the API.
+                * @throws {Error} If the API doesn't pass an array of widget ids.
+                *
+                * @returns {Array} A shallow copy of the array containing widget IDs.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                getWidgetIds: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        var sidebarPartial = this, settingId, widgetIds;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -305,11 +335,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Reflow widgets in the sidebar, ensuring they have the proper position in the DOM.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * Reflows widgets in the sidebar, ensuring they have the proper position in the
+                * DOM.
</ins><span class="cx" style="display: block; padding: 0 10px">                  *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 4.5.0
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @return {Array.<wp.customize.selectiveRefresh.Placement>} List of placements that were reflowed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @returns {Array.<wp.customize.selectiveRefresh.Placement>} List of placements
+                *                                                            that were reflowed.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                reflowWidgets: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        var sidebarPartial = this, sidebarPlacements, widgetIds, widgetPartials, sortedSidebarContainers = [];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -369,12 +401,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Make sure there is a widget instance container in this sidebar for the given widget ID.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * Makes sure there is a widget instance container in this sidebar for the given
+                * widget ID.
</ins><span class="cx" style="display: block; padding: 0 10px">                  *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 4.5.0
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @param {string} widgetId
-                * @returns {wp.customize.selectiveRefresh.Partial} Widget instance partial.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @param {string} widgetId The widget ID.
+                *
+                * @returns {wp.customize.selectiveRefresh.Partial} The widget instance partial.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                ensureWidgetPlacementContainers: function( widgetId ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        var sidebarPartial = this, widgetPartial, wasInserted = false, partialId = 'widget[' + widgetId + ']';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -435,12 +469,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Handle change to the sidebars_widgets[] setting.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * Handles changes to the sidebars_widgets[] setting.
</ins><span class="cx" style="display: block; padding: 0 10px">                  *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 4.5.0
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @param {Array} newWidgetIds New widget ids.
-                * @param {Array} oldWidgetIds Old widget ids.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @param {Array} newWidgetIds New widget IDs.
+                * @param {Array} oldWidgetIds Old widget IDs.
+                *
+                * @returns {void}
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                handleSettingChange: function( newWidgetIds, oldWidgetIds ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        var sidebarPartial = this, needsRefresh, widgetsRemoved, widgetsAdded, addedWidgetPartials = [];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -488,9 +524,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Note that the meat is handled in handleSettingChange because it has the context of which widgets were removed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * Refreshes the sidebar partial.
</ins><span class="cx" style="display: block; padding: 0 10px">                  *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 * Note that the meat is handled in handleSettingChange because it has the
+                * context of which widgets were removed.
+                *
</ins><span class="cx" style="display: block; padding: 0 10px">                  * @since 4.5.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 *
+                * @returns {Promise} A promise postponing the refresh.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                refresh: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        var partial = this, deferred = $.Deferred();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -516,9 +557,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">        api.selectiveRefresh.partialConstructor.widget = self.WidgetPartial;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Add partials for the registered widget areas (sidebars).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * Adds partials for the registered widget areas (sidebars).
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 4.5.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         *
+        * @returns {void}
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        self.addPartials = function() {
</span><span class="cx" style="display: block; padding: 0 10px">                _.each( self.registeredSidebars, function( registeredSidebar ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -536,11 +579,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Calculate the selector for the sidebar's widgets based on the registered sidebar's info.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * Calculates the selector for the sidebar's widgets based on the registered
+        * sidebar's info.
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @memberOf wp.customize.widgetsPreview
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 3.9.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         *
+        * @returns {void}
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        self.buildWidgetSelectors = function() {
</span><span class="cx" style="display: block; padding: 0 10px">                var self = this;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -576,12 +622,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Highlight the widget on widget updates or widget control mouse overs.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * Highlights the widget on widget updates or widget control mouse overs.
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @memberOf wp.customize.widgetsPreview
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 3.9.0
</span><span class="cx" style="display: block; padding: 0 10px">         * @param  {string} widgetId ID of the widget.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         *
+        * @returns {void}
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        self.highlightWidget = function( widgetId ) {
</span><span class="cx" style="display: block; padding: 0 10px">                var $body = $( document.body ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -596,12 +644,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Show a title and highlight widgets on hover. On shift+clicking
-        * focus the widget control.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * Shows a title and highlights widgets on hover. On shift+clicking focuses the
+        * widget control.
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @memberOf wp.customize.widgetsPreview
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 3.9.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         *
+        * @returns {void}
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        self.highlightControls = function() {
</span><span class="cx" style="display: block; padding: 0 10px">                var self = this,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -613,7 +663,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $( selector ).attr( 'title', this.l10n.widgetTooltip );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Highlights widget when entering the widget editor.
</ins><span class="cx" style="display: block; padding: 0 10px">                 $( document ).on( 'mouseenter', selector, function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        self.preview.send( 'highlight-widget-control', $( this ).prop( 'id' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                });
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -630,14 +680,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Parse a widget ID.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * Parses a widget ID.
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @memberOf wp.customize.widgetsPreview
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 4.5.0
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @param {string} widgetId Widget ID.
-        * @returns {{idBase: string, number: number|null}}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param {string} widgetId The widget ID.
+        *
+        * @returns {{idBase: string, number: number|null}} An object containing the
+        *          idBase and number of the parsed widget ID.
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        self.parseWidgetId = function( widgetId ) {
</span><span class="cx" style="display: block; padding: 0 10px">                var matches, parsed = {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -657,14 +709,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Parse a widget setting ID.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * Parses a widget setting ID.
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @memberOf wp.customize.widgetsPreview
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 4.5.0
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param {string} settingId Widget setting ID.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @returns {{idBase: string, number: number|null}|null}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  *
+        * @returns {{idBase: string, number: number|null}|null} Either an object
+        *          containing the idBase and number of the parsed widget setting ID, or
+        *          null.
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        self.parseWidgetSettingId = function( settingId ) {
</span><span class="cx" style="display: block; padding: 0 10px">                var matches, parsed = {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -684,14 +739,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Convert a widget ID into a Customizer setting ID.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * Converts a widget ID into a Customizer setting ID.
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @memberOf wp.customize.widgetsPreview
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 4.5.0
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @param {string} widgetId Widget ID.
-        * @returns {string} settingId Setting ID.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param {string} widgetId The widget ID.
+        *
+        * @returns {string} The setting ID.
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        self.getWidgetSettingId = function( widgetId ) {
</span><span class="cx" style="display: block; padding: 0 10px">                var parsed = this.parseWidgetId( widgetId ), settingId;
</span></span></pre>
</div>
</div>

</body>
</html>