<!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>[26035] trunk/src/wp-admin/js/revisions.js: jshint: fixes for revisions.js, props adamsilverstein, fixes #25864.</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">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/26035">26035</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2013-11-07 18:13:33 +0000 (Thu, 07 Nov 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>jshint: fixes for revisions.js, props adamsilverstein, fixes <a href="http://core.trac.wordpress.org/ticket/25864">#25864</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjsrevisionsjs">trunk/src/wp-admin/js/revisions.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjsrevisionsjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/revisions.js (26034 => 26035)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/revisions.js       2013-11-07 17:28:56 UTC (rev 26034)
+++ trunk/src/wp-admin/js/revisions.js  2013-11-07 18:13:33 UTC (rev 26035)
</span><span class="lines">@@ -1,3 +1,4 @@
</span><ins>+/*global _, Backbone, _wpRevisionsSettings, isRtl */
</ins><span class="cx"> window.wp = window.wp || {};
</span><span class="cx"> 
</span><span class="cx"> (function($) {
</span><span class="lines">@@ -12,8 +13,9 @@
</span><span class="cx">  revisions.debug = false;
</span><span class="cx"> 
</span><span class="cx">  revisions.log = function() {
</span><del>-               if ( window.console && revisions.debug )
-                       console.log.apply( console, arguments );
</del><ins>+                if ( window.console && revisions.debug ) {
+                       window.console.log.apply( window.console, arguments );
+               }
</ins><span class="cx">   };
</span><span class="cx"> 
</span><span class="cx">  // Handy functions to help with positioning
</span><span class="lines">@@ -34,14 +36,17 @@
</span><span class="cx">  };
</span><span class="cx"> 
</span><span class="cx">  // wp_localize_script transforms top-level numbers into strings. Undo that.
</span><del>-       if ( revisions.settings.to )
</del><ins>+        if ( revisions.settings.to ) {
</ins><span class="cx">           revisions.settings.to = parseInt( revisions.settings.to, 10 );
</span><del>-       if ( revisions.settings.from )
</del><ins>+        }
+       if ( revisions.settings.from ) {
</ins><span class="cx">           revisions.settings.from = parseInt( revisions.settings.from, 10 );
</span><ins>+       }
</ins><span class="cx"> 
</span><span class="cx">  // wp_localize_script does not allow for top-level booleans. Fix that.
</span><del>-       if ( revisions.settings.compareTwoMode )
</del><ins>+        if ( revisions.settings.compareTwoMode ) {
</ins><span class="cx">           revisions.settings.compareTwoMode = revisions.settings.compareTwoMode === '1';
</span><ins>+       }
</ins><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * ========================================================================
</span><span class="lines">@@ -130,8 +135,9 @@
</span><span class="cx">          // Receives revisions changes from outside the model
</span><span class="cx">          receiveRevisions: function( from, to ) {
</span><span class="cx">                  // Bail if nothing changed
</span><del>-                       if ( this.get('from') === from && this.get('to') === to )
</del><ins>+                        if ( this.get('from') === from && this.get('to') === to ) {
</ins><span class="cx">                           return;
</span><ins>+                       }
</ins><span class="cx"> 
</span><span class="cx">                  this.set({ from: from, to: to }, { silent: true });
</span><span class="cx">                  this.trigger( 'update:revisions', from, to );
</span><span class="lines">@@ -183,15 +189,17 @@
</span><span class="cx">          next: function( revision ) {
</span><span class="cx">                  var index = this.indexOf( revision );
</span><span class="cx"> 
</span><del>-                       if ( index !== -1 && index !== this.length - 1 )
</del><ins>+                        if ( index !== -1 && index !== this.length - 1 ) {
</ins><span class="cx">                           return this.at( index + 1 );
</span><ins>+                       }
</ins><span class="cx">           },
</span><span class="cx"> 
</span><span class="cx">          prev: function( revision ) {
</span><span class="cx">                  var index = this.indexOf( revision );
</span><span class="cx"> 
</span><del>-                       if ( index !== -1 && index !== 0 )
</del><ins>+                        if ( index !== -1 && index !== 0 ) {
</ins><span class="cx">                           return this.at( index - 1 );
</span><ins>+                       }
</ins><span class="cx">           }
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="lines">@@ -202,7 +210,7 @@
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="cx">  revisions.model.Diff = Backbone.Model.extend({
</span><del>-               initialize: function( attributes, options ) {
</del><ins>+                initialize: function() {
</ins><span class="cx">                   var fields = this.get('fields');
</span><span class="cx">                  this.unset('fields');
</span><span class="cx"> 
</span><span class="lines">@@ -221,12 +229,12 @@
</span><span class="cx">          model: revisions.model.Diff,
</span><span class="cx"> 
</span><span class="cx">          ensure: function( id, context ) {
</span><del>-                       var diff     = this.get( id );
-                       var request  = this.requests[ id ];
-                       var deferred = $.Deferred();
-                       var ids      = {};
-                       var from     = id.split(':')[0];
-                       var to       = id.split(':')[1];
</del><ins>+                        var diff     = this.get( id ),
+                               request  = this.requests[ id ],
+                               deferred = $.Deferred(),
+                               ids      = {},
+                               from     = id.split(':')[0],
+                               to       = id.split(':')[1];
</ins><span class="cx">                   ids[id] = true;
</span><span class="cx"> 
</span><span class="cx">                  wp.revisions.log( 'ensure', id );
</span><span class="lines">@@ -239,11 +247,13 @@
</span><span class="cx">                          this.trigger( 'ensure:load', ids, from, to, deferred.promise() );
</span><span class="cx">                          _.each( ids, _.bind( function( id ) {
</span><span class="cx">                                  // Remove anything that has an ongoing request
</span><del>-                                       if ( this.requests[ id ] )
</del><ins>+                                        if ( this.requests[ id ] ) {
</ins><span class="cx">                                           delete ids[ id ];
</span><ins>+                                       }
</ins><span class="cx">                                   // Remove anything we already have
</span><del>-                                       if ( this.get( id ) )
</del><ins>+                                        if ( this.get( id ) ) {
</ins><span class="cx">                                           delete ids[ id ];
</span><ins>+                                       }
</ins><span class="cx">                           }, this ) );
</span><span class="cx">                          if ( ! request ) {
</span><span class="cx">                                  // Always include the ID that started this ensure
</span><span class="lines">@@ -274,8 +284,8 @@
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          _loadAll: function( allRevisionIds, centerId, num ) {
</span><del>-                       var self = this, deferred = $.Deferred();
-                       diffs = _.first( this.getClosestUnloaded( allRevisionIds, centerId ), num );
</del><ins>+                        var self = this, deferred = $.Deferred(),
+                               diffs = _.first( this.getClosestUnloaded( allRevisionIds, centerId ), num );
</ins><span class="cx">                   if ( _.size( diffs ) > 0 ) {
</span><span class="cx">                          this.load( diffs ).done( function() {
</span><span class="cx">                                  self._loadAll( allRevisionIds, centerId, num ).done( function() {
</span><span class="lines">@@ -299,7 +309,7 @@
</span><span class="cx">          load: function( comparisons ) {
</span><span class="cx">                  wp.revisions.log( 'load', comparisons );
</span><span class="cx">                  // Our collection should only ever grow, never shrink, so remove: false
</span><del>-                       return this.fetch({ data: { compare: comparisons }, remove: false }).done( function(){
</del><ins>+                        return this.fetch({ data: { compare: comparisons }, remove: false }).done( function() {
</ins><span class="cx">                           wp.revisions.log( 'load:complete', comparisons );
</span><span class="cx">                  });
</span><span class="cx">          },
</span><span class="lines">@@ -313,8 +323,8 @@
</span><span class="cx">                                  post_id: revisions.settings.postId
</span><span class="cx">                          });
</span><span class="cx"> 
</span><del>-                               var deferred = wp.ajax.send( options );
-                               var requests = this.requests;
</del><ins>+                                var deferred = wp.ajax.send( options ),
+                                       requests = this.requests;
</ins><span class="cx"> 
</span><span class="cx">                          // Record that we're requesting each diff.
</span><span class="cx">                          if ( options.data.compare ) {
</span><span class="lines">@@ -423,8 +433,9 @@
</span><span class="cx">                  diffId = ( from ? from.id : 0 ) + ':' + to.id;
</span><span class="cx"> 
</span><span class="cx">                  // Check if we're actually changing the diff id.
</span><del>-                       if ( this._diffId === diffId )
</del><ins>+                        if ( this._diffId === diffId ) {
</ins><span class="cx">                           return $.Deferred().reject().promise();
</span><ins>+                       }
</ins><span class="cx"> 
</span><span class="cx">                  this._diffId = diffId;
</span><span class="cx">                  this.trigger( 'update:revisions', from, to );
</span><span class="lines">@@ -448,7 +459,7 @@
</span><span class="cx"> 
</span><span class="cx">          // A simple wrapper around `updateDiff` to prevent the change event's
</span><span class="cx">          // parameters from being passed through.
</span><del>-               changeRevisionHandler: function( model, value, options ) {
</del><ins>+                changeRevisionHandler: function() {
</ins><span class="cx">                   this.updateDiff();
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="lines">@@ -545,10 +556,10 @@
</span><span class="cx">                  var slider = new revisions.model.Slider({
</span><span class="cx">                          frame: this.model,
</span><span class="cx">                          revisions: this.model.revisions
</span><del>-                       });
</del><ins>+                        }),
</ins><span class="cx"> 
</span><span class="cx">                  // Prep the tooltip model
</span><del>-                       var tooltip = new revisions.model.Tooltip({
</del><ins>+                        tooltip = new revisions.model.Tooltip({
</ins><span class="cx">                           frame: this.model,
</span><span class="cx">                          revisions: this.model.revisions,
</span><span class="cx">                          slider: slider
</span><span class="lines">@@ -579,10 +590,10 @@
</span><span class="cx">                  this.top = this.$el.offset().top;
</span><span class="cx">                  this.window = $(window);
</span><span class="cx">                  this.window.on( 'scroll.wp.revisions', {controls: this}, function(e) {
</span><del>-                               var controls = e.data.controls;
-                               var container = controls.$el.parent();
-                               var scrolled = controls.window.scrollTop();
-                               var frame = controls.views.parent;
</del><ins>+                                var controls  = e.data.controls,
+                                       container = controls.$el.parent(),
+                                       scrolled  = controls.window.scrollTop(),
+                                       frame     = controls.views.parent;
</ins><span class="cx"> 
</span><span class="cx">                          if ( scrolled >= controls.top ) {
</span><span class="cx">                                  if ( ! frame.$el.hasClass('pinned') ) {
</span><span class="lines">@@ -724,8 +735,9 @@
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          ready: function() {
</span><del>-                       if ( this.model.revisions.length < 3 )
</del><ins>+                        if ( this.model.revisions.length < 3 ) {
</ins><span class="cx">                           $('.revision-toggle-compare-mode').hide();
</span><ins>+                       }
</ins><span class="cx">           },
</span><span class="cx"> 
</span><span class="cx">          updateCompareTwoMode: function() {
</span><span class="lines">@@ -733,7 +745,7 @@
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          // Toggle the compare two mode feature when the compare two checkbox is checked.
</span><del>-               compareTwoToggle: function( event ) {
</del><ins>+                compareTwoToggle: function() {
</ins><span class="cx">                   // Activate compare two mode?
</span><span class="cx">                  this.model.set({ compareTwoMode: $('.compare-two-revisions').prop('checked') });
</span><span class="cx">          }
</span><span class="lines">@@ -745,23 +757,30 @@
</span><span class="cx">          className: 'revisions-tooltip',
</span><span class="cx">          template: wp.template('revisions-meta'),
</span><span class="cx"> 
</span><del>-               initialize: function( options ) {
</del><ins>+                initialize: function() {
</ins><span class="cx">                   this.listenTo( this.model, 'change:offset', this.render );
</span><span class="cx">                  this.listenTo( this.model, 'change:hovering', this.toggleVisibility );
</span><span class="cx">                  this.listenTo( this.model, 'change:scrubbing', this.toggleVisibility );
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          prepare: function() {
</span><del>-                       if ( _.isNull( this.model.get('revision') ) )
</del><ins>+                        if ( _.isNull( this.model.get('revision') ) ) {
</ins><span class="cx">                           return;
</span><del>-                       else
</del><ins>+                        } else {
</ins><span class="cx">                           return _.extend( { type: 'tooltip' }, {
</span><span class="cx">                                  attributes: this.model.get('revision').toJSON()
</span><span class="cx">                          });
</span><ins>+                       }
</ins><span class="cx">           },
</span><span class="cx"> 
</span><span class="cx">          render: function() {
</span><del>-                       var direction, directionVal, flipped, css = {}, position = this.model.revisions.indexOf( this.model.get('revision') ) + 1;
</del><ins>+                        var otherDirection,
+                               direction,
+                               directionVal,
+                               flipped,
+                               css      = {},
+                               position = this.model.revisions.indexOf( this.model.get('revision') ) + 1;
+
</ins><span class="cx">                   flipped = ( position / this.model.revisions.length ) > 0.5;
</span><span class="cx">                  if ( isRtl ) {
</span><span class="cx">                          direction = flipped ? 'left' : 'right';
</span><span class="lines">@@ -781,11 +800,12 @@
</span><span class="cx">                  return this.model.get( 'scrubbing' ) || this.model.get( 'hovering' );
</span><span class="cx">          },
</span><span class="cx"> 
</span><del>-               toggleVisibility: function( options ) {
-                       if ( this.visible() )
</del><ins>+                toggleVisibility: function() {
+                       if ( this.visible() ) {
</ins><span class="cx">                           this.$el.stop().show().fadeTo( 100 - this.el.style.opacity * 100, 1 );
</span><del>-                       else
</del><ins>+                        } else {
</ins><span class="cx">                           this.$el.stop().fadeTo( this.el.style.opacity * 300, 0, function(){ $(this).hide(); } );
</span><ins>+                       }
</ins><span class="cx">                   return;
</span><span class="cx">          }
</span><span class="cx">  });
</span><span class="lines">@@ -815,10 +835,11 @@
</span><span class="cx">                          to: this.model.revisions.at( toIndex )
</span><span class="cx">                  };
</span><span class="cx">                  // If we're at the first revision, unset 'from'.
</span><del>-                       if ( toIndex )
</del><ins>+                        if ( toIndex ) {
</ins><span class="cx">                           attributes.from = this.model.revisions.at( toIndex - 1 );
</span><del>-                       else
</del><ins>+                        } else {
</ins><span class="cx">                           this.model.unset('from', { silent: true });
</span><ins>+                       }
</ins><span class="cx"> 
</span><span class="cx">                  this.model.set( attributes );
</span><span class="cx">          },
</span><span class="lines">@@ -837,11 +858,11 @@
</span><span class="cx"> 
</span><span class="cx">          // Check to see if the Previous or Next buttons need to be disabled or enabled.
</span><span class="cx">          disabledButtonCheck: function() {
</span><del>-                       var maxVal = this.model.revisions.length - 1,
-                               minVal = 0,
-                               next = $('.revisions-next .button'),
</del><ins>+                        var maxVal   = this.model.revisions.length - 1,
+                               minVal   = 0,
+                               next     = $('.revisions-next .button'),
</ins><span class="cx">                           previous = $('.revisions-previous .button'),
</span><del>-                               val = this.model.revisions.indexOf( this.model.get('to') );
</del><ins>+                                val      = this.model.revisions.indexOf( this.model.get('to') );
</ins><span class="cx"> 
</span><span class="cx">                  // Disable "Next" button if you're on the last node.
</span><span class="cx">                  next.prop( 'disabled', ( maxVal === val ) );
</span><span class="lines">@@ -884,19 +905,19 @@
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          mouseMove: function( e ) {
</span><del>-                       var zoneCount = this.model.revisions.length - 1, // One fewer zone than models
-                               sliderFrom = this.$el.allOffsets()[this.direction], // "From" edge of slider
-                               sliderWidth = this.$el.width(), // Width of slider
-                               tickWidth = sliderWidth / zoneCount, // Calculated width of zone
-                               actualX = isRtl? $(window).width() - e.pageX : e.pageX; // Flipped for RTL - sliderFrom;
-                       actualX = actualX - sliderFrom; // Offset of mouse position in slider
-                       var currentModelIndex = Math.floor( ( actualX + ( tickWidth / 2 )  ) / tickWidth ); // Calculate the model index
</del><ins>+                        var zoneCount         = this.model.revisions.length - 1, // One fewer zone than models
+                               sliderFrom        = this.$el.allOffsets()[this.direction], // "From" edge of slider
+                               sliderWidth       = this.$el.width(), // Width of slider
+                               tickWidth         = sliderWidth / zoneCount, // Calculated width of zone
+                               actualX           = ( isRtl ? $(window).width() - e.pageX : e.pageX ) - sliderFrom, // Flipped for RTL - sliderFrom;
+                               currentModelIndex = Math.floor( ( actualX  + ( tickWidth / 2 )  ) / tickWidth ); // Calculate the model index
</ins><span class="cx"> 
</span><span class="cx">                  // Ensure sane value for currentModelIndex.
</span><del>-                       if ( currentModelIndex < 0 )
</del><ins>+                        if ( currentModelIndex < 0 ) {
</ins><span class="cx">                           currentModelIndex = 0;
</span><del>-                       else if ( currentModelIndex >= this.model.revisions.length )
</del><ins>+                        } else if ( currentModelIndex >= this.model.revisions.length ) {
</ins><span class="cx">                           currentModelIndex = this.model.revisions.length - 1;
</span><ins>+                       }
</ins><span class="cx"> 
</span><span class="cx">                  // Update the tooltip mode
</span><span class="cx">                  this.model.set({ hoveredRevision: this.model.revisions.at( currentModelIndex ) });
</span><span class="lines">@@ -940,12 +961,13 @@
</span><span class="cx">                              rightDragBoundary = sliderRightEdge,
</span><span class="cx">                              leftDragReset     = '0',
</span><span class="cx">                              rightDragReset    = '100%',
</span><ins>+                                   handles,
</ins><span class="cx">                               handle            = $( ui.handle );
</span><span class="cx"> 
</span><span class="cx">                          // In two handle mode, ensure handles can't be dragged past each other.
</span><span class="cx">                          // Adjust left/right boundaries and reset points.
</span><span class="cx">                          if ( view.model.get('compareTwoMode') ) {
</span><del>-                                       var handles = handle.parent().find('.ui-slider-handle');
</del><ins>+                                        handles = handle.parent().find('.ui-slider-handle');
</ins><span class="cx">                                   if ( handle.is( handles.first() ) ) { // We're the left handle
</span><span class="cx">                                          rightDragBoundary = handles.last().offset().left;
</span><span class="cx">                                          rightDragReset    = rightDragBoundary - sliderOffset;
</span><span class="lines">@@ -976,10 +998,12 @@
</span><span class="cx">                  // Compare two revisions mode
</span><span class="cx">                  if ( this.model.get('compareTwoMode') ) {
</span><span class="cx">                          // Prevent sliders from occupying same spot
</span><del>-                               if ( ui.values[1] === ui.values[0] )
</del><ins>+                                if ( ui.values[1] === ui.values[0] ) {
</ins><span class="cx">                                   return false;
</span><del>-                               if ( isRtl )
</del><ins>+                                }
+                               if ( isRtl ) {
</ins><span class="cx">                                   ui.values.reverse();
</span><ins>+                               }
</ins><span class="cx">                           attributes = {
</span><span class="cx">                                  from: this.model.revisions.at( this.getPosition( ui.values[0] ) ),
</span><span class="cx">                                  to: this.model.revisions.at( this.getPosition( ui.values[1] ) )
</span><span class="lines">@@ -989,21 +1013,23 @@
</span><span class="cx">                                  to: this.model.revisions.at( this.getPosition( ui.value ) )
</span><span class="cx">                          };
</span><span class="cx">                          // If we're at the first revision, unset 'from'.
</span><del>-                               if ( this.getPosition( ui.value ) > 0 )
</del><ins>+                                if ( this.getPosition( ui.value ) > 0 ) {
</ins><span class="cx">                                   attributes.from = this.model.revisions.at( this.getPosition( ui.value ) - 1 );
</span><del>-                               else
</del><ins>+                                } else {
</ins><span class="cx">                                   attributes.from = undefined;
</span><ins>+                               }
</ins><span class="cx">                   }
</span><span class="cx">                  movedRevision = this.model.revisions.at( this.getPosition( ui.value ) );
</span><span class="cx"> 
</span><span class="cx">                  // If we are scrubbing, a scrub to a revision is considered a hover
</span><del>-                       if ( this.model.get('scrubbing') )
</del><ins>+                        if ( this.model.get('scrubbing') ) {
</ins><span class="cx">                           attributes.hoveredRevision = movedRevision;
</span><ins>+                       }
</ins><span class="cx"> 
</span><span class="cx">                  this.model.set( attributes );
</span><span class="cx">          },
</span><span class="cx"> 
</span><del>-               stop: function( event, ui ) {
</del><ins>+                stop: function() {
</ins><span class="cx">                   $( window ).off('mousemove.wp.revisions');
</span><span class="cx">                  this.model.updateSliderSettings(); // To snap us back to a tick mark
</span><span class="cx">                  this.model.set({ scrubbing: false });
</span><span class="lines">@@ -1014,7 +1040,7 @@
</span><span class="cx">  // This is the view for the current active diff.
</span><span class="cx">  revisions.view.Diff = wp.Backbone.View.extend({
</span><span class="cx">          className: 'revisions-diff',
</span><del>-               template: wp.template('revisions-diff'),
</del><ins>+                template:  wp.template('revisions-diff'),
</ins><span class="cx"> 
</span><span class="cx">          // Generate the options to be passed to the template.
</span><span class="cx">          prepare: function() {
</span><span class="lines">@@ -1041,16 +1067,17 @@
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          updateUrl: function() {
</span><del>-                       var from = this.model.has('from') ? this.model.get('from').id : 0;
-                       var to = this.model.get('to').id;
-                       if ( this.model.get('compareTwoMode' ) )
</del><ins>+                        var from = this.model.has('from') ? this.model.get('from').id : 0,
+                               to   = this.model.get('to').id;
+                       if ( this.model.get('compareTwoMode' ) ) {
</ins><span class="cx">                           this.navigate( this.baseUrl( '?from=' + from + '&to=' + to ) );
</span><del>-                       else
</del><ins>+                        } else {
</ins><span class="cx">                           this.navigate( this.baseUrl( '?revision=' + to ) );
</span><ins>+                       }
</ins><span class="cx">           },
</span><span class="cx"> 
</span><span class="cx">          handleRoute: function( a, b ) {
</span><del>-                       var from, to, compareTwo = _.isUndefined( b );
</del><ins>+                        var compareTwo = _.isUndefined( b );
</ins><span class="cx"> 
</span><span class="cx">                  if ( ! compareTwo ) {
</span><span class="cx">                          b = this.model.revisions.get( a );
</span></span></pre>
</div>
</div>

</body>
</html>