Gergő Tisza has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/124363

Change subject: Avoid using using 'super' as an ES3 Identifier on OOJS
......................................................................

Avoid using using 'super' as an ES3 Identifier on OOJS

ES3 is slightly more strict about identifier names than ES5:
reserved words are not allowed as variable names, object literal
keys or field names in dot notation. Because of this, OOJS
breaks in ES3 browsers (such as IE6-8). There is (hopefully)
an easy fix for that as field names and object literal keys can
be changed to use a string literal instead of an identifier name:

    foo.bar     -->   foo['bar']
    foo: 'bar'  -->   'foo': 'bar'

This patch is for testing purposes only, should be upstreamed
if it works.

Change-Id: I6cd13b4f3a72378eb27e3aaa313511ffb20227c3
---
M resources/oojs/oojs.js
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/63/124363/1

diff --git a/resources/oojs/oojs.js b/resources/oojs/oojs.js
index f953878..82fa470 100644
--- a/resources/oojs/oojs.js
+++ b/resources/oojs/oojs.js
@@ -77,14 +77,15 @@
  *     Thing.prototype.exists = function () {};
  *
  *     function Person() {
- *         Person.super.apply( this, arguments );
+ *         // [] notation used for ES3 compatibility - 'super' is a reserved 
word
+ *         Person['super'].apply( this, arguments );
  *     }
  *     OO.inheritClass( Person, Thing );
  *     Person.static.defaultEyeCount = 2;
  *     Person.prototype.walk = function () {};
  *
  *     function Jumper() {
- *         Jumper.super.apply( this, arguments );
+ *         Jumper['super'].apply( this, arguments );
  *     }
  *     OO.inheritClass( Jumper, Person );
  *     Jumper.prototype.jump = function () {};
@@ -106,7 +107,7 @@
 
        var targetConstructor = targetFn.prototype.constructor;
 
-       targetFn.super = originFn;
+       targetFn['super'] = originFn;
        targetFn.prototype = Object.create( originFn.prototype, {
                // Restore constructor property of targetFn
                constructor: {
@@ -761,7 +762,7 @@
  * @constructor
  */
 oo.Factory = function OoFactory() {
-       oo.Factory.super.call( this );
+       oo.Factory['super'].call( this );
 
        // Properties
        this.entries = [];
@@ -801,7 +802,7 @@
        }
        this.entries.push( name );
 
-       oo.Factory.super.prototype.register.call( this, name, constructor );
+       oo.Factory['super'].prototype.register.call( this, name, constructor );
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/124363
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6cd13b4f3a72378eb27e3aaa313511ffb20227c3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to