Jforrester has uploaded a new change for review. https://gerrit.wikimedia.org/r/186401
Change subject: Update OOjs to v1.1.4 and switch to the jQuery-optimised version ...................................................................... Update OOjs to v1.1.4 and switch to the jQuery-optimised version Release notes: https://git.wikimedia.org/blob/oojs%2Fcore.git/v1.1.4/History.md Change-Id: Ib8736816e4e93306766c56cefee4b7d380944a99 --- M Gruntfile.js M demos/index.html M jsduck.json R lib/oojs.jquery.js M tests/index.php 5 files changed, 20 insertions(+), 43 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/01/186401/1 diff --git a/Gruntfile.js b/Gruntfile.js index 1d3f257..506e15c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -275,7 +275,7 @@ frameworks: [ 'qunit' ], files: [ 'lib/jquery.js', - 'lib/oojs.js', + 'lib/oojs.jquery.js', 'dist/oojs-ui.js', 'dist/oojs-ui-apex.js', 'tests/**/*.test.js' diff --git a/demos/index.html b/demos/index.html index fc280b2..4e14bd4 100644 --- a/demos/index.html +++ b/demos/index.html @@ -8,7 +8,7 @@ </head> <body> <script src="../lib/jquery.js"></script> - <script src="../lib/oojs.js"></script> + <script src="../lib/oojs.jquery.js"></script> <script src="../dist/oojs-ui.js"></script> <script src="../dist/oojs-ui-apex.js"></script> <script src="../dist/oojs-ui-mediawiki.js"></script> diff --git a/jsduck.json b/jsduck.json index da6cff6..9c380bb 100644 --- a/jsduck.json +++ b/jsduck.json @@ -9,7 +9,7 @@ "--warnings": ["-nodoc(class,public)"], "--": [ "jsduck.external.js", - "lib/oojs.js", + "lib/oojs.jquery.js", "src" ] } diff --git a/lib/oojs.js b/lib/oojs.jquery.js similarity index 95% rename from lib/oojs.js rename to lib/oojs.jquery.js index f06779c..0b61721 100644 --- a/lib/oojs.js +++ b/lib/oojs.jquery.js @@ -1,12 +1,12 @@ /*! - * OOjs v1.1.3 + * OOjs v1.1.4 optimised for jQuery * https://www.mediawiki.org/wiki/OOjs * - * Copyright 2011-2014 OOjs Team and other contributors. + * Copyright 2011-2015 OOjs Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2014-11-17T19:17:29Z + * Date: 2015-01-23T20:11:25Z */ ( function ( global ) { @@ -170,7 +170,7 @@ * * @param {Object} obj * @param {Mixed...} [keys] - * @returns obj[arguments[1]][arguments[2]].... or undefined + * @return obj[arguments[1]][arguments[2]].... or undefined */ oo.getProp = function ( obj ) { var i, @@ -521,38 +521,9 @@ return simpleArrayCombine( a, b, false ); }; -/*global hasOwn, toString */ +/*global $ */ -/** - * Assert whether a value is a plain object or not. - * - * @param {Mixed} obj - * @return {boolean} - */ -oo.isPlainObject = function ( obj ) { - /*jshint eqnull:true, eqeqeq:false */ - - // Any object or value whose internal [[Class]] property is not "[object Object]" - // Support IE8: Explicitly filter out DOM nodes - // Support IE8: Explicitly filter out Window object (needs loose comparison) - if ( !obj || toString.call( obj ) !== '[object Object]' || obj.nodeType || ( obj != null && obj == obj.window ) ) { - return false; - } - - // The try/catch suppresses exceptions thrown when attempting to access - // the "constructor" property of certain host objects suich as window.location - // in Firefox < 20 (https://bugzilla.mozilla.org/814622) - try { - if ( obj.constructor && - !hasOwn.call( obj.constructor.prototype, 'isPrototypeOf' ) ) { - return false; - } - } catch ( e ) { - return false; - } - - return true; -}; +oo.isPlainObject = $.isPlainObject; /*global hasOwn */ @@ -716,12 +687,15 @@ * @return {boolean} If event was handled by at least one listener */ oo.EventEmitter.prototype.emit = function ( event ) { - var i, len, binding, bindings, args, method; + var args = [], + i, len, binding, bindings, method; if ( hasOwn.call( this.bindings, event ) ) { // Slicing ensures that we don't get tripped up by event handlers that add/remove bindings bindings = this.bindings[event].slice(); - args = Array.prototype.slice.call( arguments, 1 ); + for ( i = 1, len = arguments.length; i < len; i++ ) { + args.push( arguments[i] ); + } for ( i = 0, len = bindings.length; i < len; i++ ) { binding = bindings[i]; if ( typeof binding.method === 'string' ) { @@ -935,7 +909,8 @@ * @throws {Error} Unknown object name */ oo.Factory.prototype.create = function ( name ) { - var args, obj, + var obj, i, + args = [], constructor = this.lookup( name ); if ( !constructor ) { @@ -943,7 +918,9 @@ } // Convert arguments to array and shift the first argument (name) off - args = Array.prototype.slice.call( arguments, 1 ); + for ( i = 1; i < arguments.length; i++ ) { + args.push( arguments[i] ); + } // We can't use the "new" operator with .apply directly because apply needs a // context. So instead just do what "new" does: create an object that inherits from diff --git a/tests/index.php b/tests/index.php index 93a30fd..7ce1fda 100644 --- a/tests/index.php +++ b/tests/index.php @@ -24,7 +24,7 @@ </script> <!-- Dependencies --> <script src="../lib/jquery.js"></script> - <script src="../lib/oojs.js"></script> + <script src="../lib/oojs.jquery.js"></script> <!-- Source code --> <script src="../dist/oojs-ui.js"></script> <script src="../dist/oojs-ui-mediawiki.js"></script> -- To view, visit https://gerrit.wikimedia.org/r/186401 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib8736816e4e93306766c56cefee4b7d380944a99 Gerrit-PatchSet: 1 Gerrit-Project: oojs/ui Gerrit-Branch: master Gerrit-Owner: Jforrester <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
