From 31d1ff2ad19239557d2a8a47b97e256d56e1e893 Mon Sep 17 00:00:00 2001 From: Ronny Perinke Date: Tue, 24 Nov 2020 08:54:35 +0100 Subject: [PATCH] Remove unneeded and falsy String.trim polyfill (#5066) 1. [it is not required anymore since ages](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Browser_compatibility) 2. If "this" is of type type "object", an instance of the same type is returned. [This is completely wrong, because it should be "string"](https://tc39.es/ecma262/#sec-string.prototype.trim), which causes things like [sorting in BootstrapVue tables to break](https://github.com/jenkinsci/dependency-track-plugin/blob/cc5f1bb8900f201384f05b633471dbd7ca48c69a/src/main/webapp/js/result-action.js#L6). --- war/src/main/webapp/scripts/hudson-behavior.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/war/src/main/webapp/scripts/hudson-behavior.js b/war/src/main/webapp/scripts/hudson-behavior.js index 9fdfec4f53..de41720260 100644 --- a/war/src/main/webapp/scripts/hudson-behavior.js +++ b/war/src/main/webapp/scripts/hudson-behavior.js @@ -2775,20 +2775,6 @@ var toggleCheckboxes = function(toggle) { } }; -// this used to be in prototype.js but it must have been removed somewhere between 1.4.0 to 1.5.1 -String.prototype.trim = function() { - var temp = this; - var obj = /^(\s*)([\W\w]*)(\b\s*$)/; - if (obj.test(temp)) - temp = temp.replace(obj, '$2'); - obj = / /g; - while (temp.match(obj)) - temp = temp.replace(obj, " "); - return temp; -} - - - var hoverNotification = (function() { var msgBox; var body;