From b1027342928520f9c4553f49039384dea6032c15 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sat, 15 Sep 2018 19:46:51 +0100 Subject: [PATCH] resourceloader: Remove check for Function#bind and Object.defineProperty * Function#bind is a given per the explicit feature test for Grade A. * Object.defineProperty is part of ES5 which is also tested for. This code is from before we required ES5 and is now redundant. Also remove the unused eslint-disable rule for global 'console' use, the code in question does not use console as global unconditionally. Change-Id: I6c77b25856da8b7717aeba8298b17a9231540d58 --- resources/src/startup/mediawiki.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/resources/src/startup/mediawiki.js b/resources/src/startup/mediawiki.js index c16948703b..06190a8257 100644 --- a/resources/src/startup/mediawiki.js +++ b/resources/src/startup/mediawiki.js @@ -259,7 +259,6 @@ defineFallbacks(); - /* eslint-disable no-console */ log = ( function () { /** * Write a verbose message to the browser's console in debug mode. @@ -293,7 +292,7 @@ * * @param {...string} msg Messages to output to console */ - log.warn = console && console.warn && Function.prototype.bind ? + log.warn = console && console.warn ? Function.prototype.bind.call( console.warn, console ) : function () {}; @@ -308,7 +307,7 @@ * @since 1.26 * @param {...Mixed} msg Messages to output to console */ - log.error = console && console.error && Function.prototype.bind ? + log.error = console && console.error ? Function.prototype.bind.call( console.error, console ) : function () {}; @@ -323,9 +322,7 @@ * @param {string} [logName=key] Optional custom name for the feature. * This is used instead of `key` in the message and `mw.deprecate` tracking. */ - log.deprecate = !Object.defineProperty ? function ( obj, key, val ) { - obj[ key ] = val; - } : function ( obj, key, val, msg, logName ) { + log.deprecate = function ( obj, key, val, msg, logName ) { var stacks; function maybeLog() { var name, @@ -365,7 +362,6 @@ return log; }() ); - /* eslint-enable no-console */ /** * @class mw -- 2.20.1