mediawiki.Title: Remove obsolete Object.create ES3 fallback
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 14 Sep 2017 17:25:15 +0000 (19:25 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 14 Sep 2017 17:25:15 +0000 (19:25 +0200)
We no longer support non-ES5 browsers.

Change-Id: If1e18dc3111899f3b0a5ae53909624186101a8ba

resources/src/mediawiki/mediawiki.Title.js

index 398adbb..53cbd60 100644 (file)
                trimFileNameToByteLength = function ( name, extension ) {
                        // There is a special byte limit for file names and ... remember the dot
                        return trimToByteLength( name, FILENAME_MAX_BYTES - extension.length - 1 ) + '.' + extension;
-               },
-
-               // Polyfill for ES5 Object.create
-               createObject = Object.create || ( function () {
-                       return function ( o ) {
-                               function Title() {}
-                               if ( o !== Object( o ) ) {
-                                       throw new Error( 'Cannot inherit from a non-object' );
-                               }
-                               Title.prototype = o;
-                               return new Title();
-                       };
-               }() );
+               };
 
        /* Static members */
 
                        return null;
                }
 
-               t = createObject( Title.prototype );
+               t = Object.create( Title.prototype );
                t.namespace = parsed.namespace;
                t.title = parsed.title;
                t.ext = parsed.ext;