jenkins-bot has submitted this change and it was merged.
Change subject: Remove more references to ve.bind
......................................................................
Remove more references to ve.bind
Seems some of them have crept back in since I1a7fc7f2 (and we missed one
somehow)
Bug: 72156
Change-Id: I5631fb7d5963d06aeb238c1daa44344b2060ef1a
---
M modules/ve-mw/dm/models/ve.dm.MWImageModel.js
M modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js
M modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
M modules/ve-mw/ui/dialogs/ve.ui.MWTemplateDialog.js
5 files changed, 37 insertions(+), 33 deletions(-)
Approvals:
Krinkle: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
index b0cd7b2..a97295d 100644
--- a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
+++ b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
@@ -249,7 +249,8 @@
* @param {Object} [dimensions] New dimensions of the image
*/
ve.dm.MWImageModel.prototype.changeImageSource = function ( attrs, dimensions
) {
- var newDimensions, remoteFilename;
+ var newDimensions, remoteFilename,
+ imageModel = this;
if ( attrs.mediaType ) {
this.setMediaType( attrs.mediaType );
@@ -274,20 +275,20 @@
// Call for updated scalable
if ( remoteFilename ) {
- ve.dm.MWImageNode.static.getScalablePromise( remoteFilename
).done( ve.bind( function ( info ) {
- this.scalable.setOriginalDimensions( {
+ ve.dm.MWImageNode.static.getScalablePromise( remoteFilename
).done( function ( info ) {
+ imageModel.scalable.setOriginalDimensions( {
width: info.width,
height: info.height
} );
// Update media type
- this.setMediaType( info.mediatype );
+ imageModel.setMediaType( info.mediatype );
// Update defaults
ve.dm.MWImageNode.static.syncScalableToType(
- this.getType(),
+ imageModel.getType(),
info.mediatype,
- this.scalable
+ imageModel.scalable
);
- }, this ) );
+ } );
}
// Resize the new image's current dimensions to default or based on the
bounding box
@@ -1037,7 +1038,8 @@
* @param {ve.dm.Scalable} Scalable object
*/
ve.dm.MWImageModel.prototype.attachScalable = function ( scalable ) {
- var imageName = this.getResourceName().replace( /^(\.+\/)*/, '' );
+ var imageName = this.getResourceName().replace( /^(\.+\/)*/, '' ),
+ imageModel = this;
if ( this.scalable instanceof ve.dm.Scalable ) {
this.scalable.disconnect( this );
@@ -1049,28 +1051,28 @@
// Call for updated scalable
if ( imageName ) {
- ve.dm.MWImageNode.static.getScalablePromise( imageName ).done(
ve.bind( function ( info ) {
- this.scalable.setOriginalDimensions( {
+ ve.dm.MWImageNode.static.getScalablePromise( imageName ).done(
function ( info ) {
+ imageModel.scalable.setOriginalDimensions( {
width: info.width,
height: info.height
} );
// Update media type
- this.setMediaType( info.mediatype );
+ imageModel.setMediaType( info.mediatype );
// Update according to type
ve.dm.MWImageNode.static.syncScalableToType(
- this.getType(),
- this.getMediaType(),
- this.getScalable()
+ imageModel.getType(),
+ imageModel.getMediaType(),
+ imageModel.getScalable()
);
// We have to adjust the details in the initial hash if
the original
// image was 'default' since we didn't have default
until now and the
// default dimensions that were 'recorded' were wrong
- if ( !$.isEmptyObject( this.initialHash ) &&
this.initialHash.scalable.isDefault ) {
- this.initialHash.scalable.currentDimensions =
this.scalable.getDefaultDimensions();
+ if ( !$.isEmptyObject( imageModel.initialHash ) &&
imageModel.initialHash.scalable.isDefault ) {
+
imageModel.initialHash.scalable.currentDimensions =
imageModel.scalable.getDefaultDimensions();
}
- }, this ) );
+ } );
}
};
diff --git a/modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js
b/modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js
index 515014f..d4e538d 100644
--- a/modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js
+++ b/modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js
@@ -237,8 +237,8 @@
lang: mw.config.get( 'wgUserLanguage' ),
redirects: '1'
} )
- .done( ve.bind( this.fetchRequestDone, this, titles,
specs ) )
- .always( ve.bind( this.fetchRequestAlways, this, queue
) );
+ .done( this.fetchRequestDone.bind( this, titles, specs
) )
+ .always( this.fetchRequestAlways.bind( this, queue ) );
};
ve.dm.MWTransclusionModel.prototype.fetchRequestDone = function (
titles, specs, data ) {
diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js
b/modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js
index 2d8e3cb..3ea0349 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js
@@ -271,24 +271,25 @@
* @inheritdoc
*/
ve.dm.MWImageNode.prototype.getScalable = function () {
+ var imageNode = this;
if ( !this.scalablePromise ) {
this.scalablePromise =
ve.dm.MWImageNode.static.getScalablePromise( this.getFilename() )
- .done( ve.bind( function ( info ) {
+ .done( function ( info ) {
if ( info ) {
-
this.getScalable().setOriginalDimensions( {
+
imageNode.getScalable().setOriginalDimensions( {
width: info.width,
height: info.height
} );
// Update media type
- this.mediaType = info.mediatype;
+ imageNode.mediaType = info.mediatype;
// Update according to type
-
this.constructor.static.syncScalableToType(
- this.getAttribute( 'type' ),
- this.mediaType,
- this.getScalable()
+
imageNode.constructor.static.syncScalableToType(
+ imageNode.getAttribute( 'type'
),
+ imageNode.mediaType,
+ imageNode.getScalable()
);
}
- }, this ) );
+ } );
}
// Parent method
return ve.dm.ResizableNode.prototype.getScalable.call( this );
diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index 3feda3c..4094b91 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -1175,7 +1175,8 @@
*/
ve.init.mw.ViewPageTarget.prototype.showSaveDialog = function () {
this.surface.getDialogs().getWindow( 'mwSave' ).then( function ( win ) {
- var currentWindow =
this.surface.getContext().getInspectors().getCurrentWindow();
+ var currentWindow =
this.surface.getContext().getInspectors().getCurrentWindow(),
+ target = this;
// Make sure any open inspectors are closed
if ( currentWindow ) {
@@ -1208,9 +1209,9 @@
{ dir: this.surface.getModel().getDocument().getLang() }
)
// Call onSaveDialogClose() when the save dialog starts
closing
- .always( ve.bind( function ( opened ) {
- opened.always( ve.bind( this.onSaveDialogClose,
this ) );
- }, this ) );
+ .always( function ( opened ) {
+ opened.always( target.onSaveDialogClose.bind(
target ) );
+ } );
this.emit( 'saveWorkflowBegin' );
}.bind( this ) );
};
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWTemplateDialog.js
b/modules/ve-mw/ui/dialogs/ve.ui.MWTemplateDialog.js
index a7e52f3..527f700 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWTemplateDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWTemplateDialog.js
@@ -447,7 +447,7 @@
this.transclusionModel,
data.template
);
promise =
this.transclusionModel.addPart( template ).done(
- ve.bind(
this.initializeNewTemplateParameters, this )
+
this.initializeNewTemplateParameters.bind( this )
);
} else {
// New template placeholder
@@ -460,7 +460,7 @@
// Load existing template
promise = this.transclusionModel
.load( ve.copy(
this.selectedNode.getAttribute( 'mw' ) ) )
- .done( ve.bind(
this.initializeTemplateParameters, this ) );
+ .done(
this.initializeTemplateParameters.bind( this ) );
}
this.actions.setAbilities( { apply: false, insert:
false } );
this.pushPending();
--
To view, visit https://gerrit.wikimedia.org/r/169644
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5631fb7d5963d06aeb238c1daa44344b2060ef1a
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits