From 4b3f43c66475076ff61684d3b22239abdd039dfc Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Wed, 2 Apr 2014 14:40:24 -0700 Subject: [PATCH] Update OOjs to v1.0.9 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 | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/resources/oojs/oojs.js b/resources/oojs/oojs.js index cd966b93cb..f9538784dc 100644 --- a/resources/oojs/oojs.js +++ b/resources/oojs/oojs.js @@ -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 ); * -- 2.20.1