Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/174366
Change subject: Avoid 'new' to create a deferred ...................................................................... Avoid 'new' to create a deferred As per http://api.jquery.com/jQuery.Deferred/ the new operator is optional. So remove the new operator to make $.Deferred usage consistent with other parts of source code. Also see https://gerrit.wikimedia.org/r/174330 Change-Id: Ib5dbe0d2943cd19a842e03ae5d9e942f02eeccfb --- M modules/tools/ext.cx.tools.images.js M modules/tools/ext.cx.tools.mt.js M modules/tools/ext.cx.tools.template.js M tests/qunit/publish/ext.cx.publish.test.js 4 files changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/66/174366/1 diff --git a/modules/tools/ext.cx.tools.images.js b/modules/tools/ext.cx.tools.images.js index 04d63c3..f7e9c4d 100644 --- a/modules/tools/ext.cx.tools.images.js +++ b/modules/tools/ext.cx.tools.images.js @@ -24,7 +24,7 @@ * @return {jQuery.Promise} */ function getImageNamespaceTranslation( targetLanguage ) { - var deferred = new $.Deferred(); + var deferred = $.Deferred(); if ( cachedNamespaces[ targetLanguage ] ) { return deferred.resolve( cachedNamespaces[ targetLanguage ] ).promise(); diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js index b65ff61..526c75f 100644 --- a/modules/tools/ext.cx.tools.mt.js +++ b/modules/tools/ext.cx.tools.mt.js @@ -73,7 +73,7 @@ } ); return $.post( mtURL, sourceHtml ).then( null, function () { - return new $.Deferred().reject( 'service-failure', arguments ).promise(); + return $.Deferred().reject( 'service-failure', arguments ).promise(); } ); } diff --git a/modules/tools/ext.cx.tools.template.js b/modules/tools/ext.cx.tools.template.js index 93642e1..5da3039 100644 --- a/modules/tools/ext.cx.tools.template.js +++ b/modules/tools/ext.cx.tools.template.js @@ -131,7 +131,7 @@ */ TemplateTool.prototype.process = function () { var templateTool = this, - deferred = new $.Deferred(); + deferred = $.Deferred(); this.templateData = this.getTemplateData(); this.templateMapping = this.getTemplateMapping(); @@ -192,7 +192,7 @@ var pageId = Object.keys( response.query.pages )[ 0 ]; if ( pageId === '-1' ) { - return new $.Deferred().reject().promise(); + return $.Deferred().reject().promise(); } return response.query; diff --git a/tests/qunit/publish/ext.cx.publish.test.js b/tests/qunit/publish/ext.cx.publish.test.js index 2c04f0b..9e41487 100644 --- a/tests/qunit/publish/ext.cx.publish.test.js +++ b/tests/qunit/publish/ext.cx.publish.test.js @@ -23,7 +23,7 @@ QUnit.expect( 3 ); newCaptchaHandler = function ( captcha ) { - var deferred = new $.Deferred(); + var deferred = $.Deferred(); assert.ok( true, 'Captcha handler was called' ); assert.equal( captcha.captchaKey, '1234565', '...with correct captcha response' ); -- To view, visit https://gerrit.wikimedia.org/r/174366 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib5dbe0d2943cd19a842e03ae5d9e942f02eeccfb Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits