From 179bb9a6ba12172f468641b78a0ed065922d06dd Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Tue, 9 Jul 2013 07:07:53 +0000 Subject: [PATCH] Revisions: Remove redundant method, see #24425. git-svn-id: http://core.svn.wordpress.org/trunk@24600 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/revisions.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/wp-admin/js/revisions.js b/wp-admin/js/revisions.js index 680d487990..d7ae78e117 100644 --- a/wp-admin/js/revisions.js +++ b/wp-admin/js/revisions.js @@ -199,20 +199,18 @@ window.wp = window.wp || {}; revisions.model.FrameState = Backbone.Model.extend({ initialize: function( attributes, options ) { this.revisions = options.revisions; - this.diffs = new revisions.model.Diffs( [], {revisions: this.revisions} ); - this.listenTo( this, 'change:from', this.updateDiffFrom ); - this.listenTo( this, 'change:to', this.updateDiffTo ); + this.diffs = new revisions.model.Diffs( [], { revisions: this.revisions }); + this.listenTo( this, 'change:from', this.updateDiff ); + this.listenTo( this, 'change:to', this.updateDiff ); this.revisionsRouter = new revisions.router.Router({ model: this }); }, - updateDiffTo: function() { - var from = this.get( 'from' ); + // So long as `from` and `to` are changed at the same time, the diff + // will only be updated once. This is because Backbone updates all of + // the changed attributes in `set`, and then fires the `change` events. + updateDiff: function() { + var from = this.get('from'); this.set( 'diffId', (from ? from.id : '0' ) + ':' + this.get('to').id ); - }, - - updateDiffFrom: function() { - if ( this.get( 'compareTwoMode' ) ) - this.updateDiffTo(); } });