Update OOjs to v1.0.9
authorJames D. Forrester <jforrester@wikimedia.org>
Wed, 2 Apr 2014 21:40:24 +0000 (14:40 -0700)
committerKrinkle <krinklemail@gmail.com>
Thu, 3 Apr 2014 00:08:11 +0000 (00:08 +0000)
Code:
 https://oojs.github.io/releases/oojs-1.0.9.js

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fcore.git/v1.0.9/History.md

Change-Id: Ic1fea7dd3a07af32a29511191c45da90bc306b17

resources/oojs/oojs.js

index cd966b9..f953878 100644 (file)
@@ -1,12 +1,12 @@
 /*!
- * OOjs v1.0.8
+ * OOjs v1.0.9
  * https://www.mediawiki.org/wiki/OOjs
  *
  * Copyright 2011-2014 OOjs Team and other contributors.
  * Released under the MIT license
  * http://oojs.mit-license.org
  *
- * Date: Tue Mar 11 2014 19:27:31 GMT+0100 (CET)
+ * Date: Wed Apr 02 2014 14:29:36 GMT-0700 (PDT)
  */
 ( function ( global ) {
 
@@ -50,6 +50,17 @@ oo.isPlainObject = function ( obj ) {
        return true;
 };
 
+/**
+ * Utility to initialize a class for OO inheritance.
+ *
+ * Currently this just initializes an empty static object.
+ *
+ * @param {Function} fn
+ */
+oo.initClass = function ( fn ) {
+       fn.static = fn.static || {};
+};
+
 /**
  * Utility for common usage of Object#create for inheriting from one
  * prototype to another.
@@ -107,7 +118,7 @@ oo.inheritClass = function ( targetFn, originFn ) {
        } );
 
        // Extend static properties - always initialize both sides
-       originFn.static = originFn.static || {};
+       oo.initClass( originFn );
        targetFn.static = Object.create( originFn.static );
 };
 
@@ -151,7 +162,7 @@ oo.mixinClass = function ( targetFn, originFn ) {
        }
 
        // Copy static properties - always initialize both sides
-       targetFn.static = targetFn.static || {};
+       oo.initClass( targetFn );
        if ( originFn.static ) {
                for ( key in originFn.static ) {
                        if ( hasOwn.call( originFn.static, key ) ) {
@@ -159,7 +170,7 @@ oo.mixinClass = function ( targetFn, originFn ) {
                        }
                }
        } else {
-               originFn.static = {};
+               oo.initClass( originFn );
        }
 };
 
@@ -768,8 +779,9 @@ oo.inheritClass( oo.Factory, oo.Registry );
  * Classes must have a static `name` property to be registered.
  *
  *     function MyClass() {};
+ *     OO.initClass( MyClass );
  *     // Adds a static property to the class defining a symbolic name
- *     MyClass.static = { 'name': 'mine' };
+ *     MyClass.static.name = 'mine';
  *     // Registers class with factory, available via symbolic name 'mine'
  *     factory.register( MyClass );
  *