resourceloader: Simplify StringSet fallback
authorTimo Tijhof <krinklemail@gmail.com>
Sat, 15 Sep 2018 18:38:22 +0000 (19:38 +0100)
committerKrinkle <krinklemail@gmail.com>
Sat, 15 Sep 2018 20:46:07 +0000 (20:46 +0000)
Covered by tests.

Change-Id: I6a287f27d0830561275bf0be525992c59cbe441f

resources/src/startup/mediawiki.js

index bb04085..29f7445 100644 (file)
 
        function defineFallbacks() {
                // <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set>
-               StringSet = window.Set || ( function () {
-                       /**
-                        * @private
-                        * @class
-                        */
-                       function StringSet() {
-                               this.set = Object.create( null );
-                       }
-                       StringSet.prototype.add = function ( value ) {
-                               this.set[ value ] = true;
+               /**
+                * @private
+                * @class
+                */
+               StringSet = window.Set || function StringSet() {
+                       var set = Object.create( null );
+                       this.add = function ( value ) {
+                               set[ value ] = true;
                        };
-                       StringSet.prototype.has = function ( value ) {
-                               return value in this.set;
+                       this.has = function ( value ) {
+                               return value in set;
                        };
-                       return StringSet;
-               }() );
+               };
        }
 
        /**