Skip to content

Apache Lucene open-source search software

SOLR-14120: Solr Admin UI breaks when using IE11

Robert Muir3ab59aa1c910
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 8533f462636..02933b7508f 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -157,6 +157,9 @@ New Features
Improvements
---------------------
+* SOLR-14120: Define JavaScript methods 'includes' and 'startsWith' to ensure AdminUI can be displayed when using
+ Internet Explorer 11 (jafurrer).
+
* SOLR-14042: Fix varargs precommit warnings (Andraas Salamon via Jason Gerlowski)
* SOLR-14095: Replace Java serialization with Javabin in the Overseer queues (Tomás Fernández Löbbe)
diff --git a/solr/webapp/web/js/angular/app.js b/solr/webapp/web/js/angular/app.js
index e2023ba0bb6..9db0aeba629 100644
--- a/solr/webapp/web/js/angular/app.js
+++ b/solr/webapp/web/js/angular/app.js
@@ -15,6 +15,36 @@
limitations under the License.
*/
+/* SOLR-14120: Providing a manual definition for the methods 'includes' and 'startsWith' to support Internet Explorer 11. */
+if (!String.prototype.includes) {
+ String.prototype.includes = function(search, start) { 'use strict';
+ if (search instanceof RegExp) {
+ throw TypeError('first argument must not be a RegExp');
+ }
+ if (start === undefined) { start = 0; }
+ return this.indexOf(search, start) !== -1;
+ };
+}
+if (!Array.prototype.includes) {
+ Object.defineProperty(Array.prototype, "includes", {
+ enumerable: false,
+ value: function(obj) {
+ var newArr = this.filter(function(el) {
+ return el == obj;
+ });
+ return newArr.length > 0;
+ }
+ });
+}
+if (!String.prototype.startsWith) {
+ Object.defineProperty(String.prototype, 'startsWith', {
+ value: function(search, rawPos) {
+ var pos = rawPos > 0 ? rawPos|0 : 0;
+ return this.substring(pos, pos + search.length) === search;
+ }
+ });
+}
+
var solrAdminApp = angular.module("solrAdminApp", [
"ngResource",
"ngRoute",