r95563 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95562‎ | r95563 | r95564 >
Date:17:11, 26 August 2011
Author:krinkle
Status:ok
Tags:
Comment:
Updating jquery.qunit from upstream
* Source: https://github.com/jquery/qunit/tree/7f292170fa1109f1355f3e96f8973c32fc553946
* qunit.css unchanged
* In the mean time the pull request I sent has been merged in as well ( https://github.com/jquery/qunit/commit/d2978f4afc75da784c6145fc74c051858ef3c39b ), so we can extend the checkbox-toggles with (for example) the completenesstest.
Modified paths:
  • /trunk/phase3/resources/jquery/jquery.qunit.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery/jquery.qunit.js
@@ -453,8 +453,7 @@
454454 // by default, modify document.title when suite is done
455455 altertitle: true,
456456
457 - noglobals: false,
458 - notrycatch: false
 457+ urlConfig: ['noglobals', 'notrycatch']
459458 };
460459
461460 // Load paramaters
@@ -472,9 +471,6 @@
473472 // allow just a key to turn on a flag, e.g., test.html?noglobals
474473 current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true;
475474 urlParams[ current[ 0 ] ] = current[ 1 ];
476 - if ( current[ 0 ] in config ) {
477 - config[ current[ 0 ] ] = current[ 1 ];
478 - }
479475 }
480476 }
481477
@@ -694,15 +690,19 @@
695691
696692 config.blocking = false;
697693
 694+ var urlConfigHtml = '', len = config.urlConfig.length;
 695+ for ( var i = 0, val; i < len, val = config.urlConfig[i]; i++ ) {
 696+ config[val] = QUnit.urlParams[val];
 697+ urlConfigHtml += '<label><input name="' + val + '" type="checkbox"' + ( config[val] ? ' checked="checked"' : '' ) + '>' + val + '</label>';
 698+ }
 699+
698700 var userAgent = id("qunit-userAgent");
699701 if ( userAgent ) {
700702 userAgent.innerHTML = navigator.userAgent;
701703 }
702704 var banner = id("qunit-header");
703705 if ( banner ) {
704 - banner.innerHTML = '<a href="' + QUnit.url({ filter: undefined }) + '"> ' + banner.innerHTML + '</a> ' +
705 - '<label><input name="noglobals" type="checkbox"' + ( config.noglobals ? ' checked="checked"' : '' ) + '>noglobals</label>' +
706 - '<label><input name="notrycatch" type="checkbox"' + ( config.notrycatch ? ' checked="checked"' : '' ) + '>notrycatch</label>';
 706+ banner.innerHTML = '<a href="' + QUnit.url({ filter: undefined }) + '"> ' + banner.innerHTML + '</a> ' + urlConfigHtml;
707707 addEvent( banner, "change", function( event ) {
708708 var params = {};
709709 params[ event.target.name ] = event.target.checked ? true : undefined;
@@ -847,6 +847,10 @@
848848 } else if (e.stack) {
849849 // Firefox, Chrome
850850 return e.stack.split("\n")[4];
 851+ } else if (e.sourceURL) {
 852+ // Safari, PhantomJS
 853+ // TODO sourceURL points at the 'throw new Error' line above, useless
 854+ //return e.sourceURL + ":" + e.line;
851855 }
852856 }
853857 }
@@ -1198,10 +1202,10 @@
11991203 if (type == 'function') {
12001204 stack.push(obj);
12011205 var res = parser.call( this, obj, stack );
1202 - stack.pop();
 1206+ stack.pop();
12031207 return res;
1204 - }
1205 - // else
 1208+ }
 1209+ // else
12061210 return (type == 'string') ? parser : this.parsers.error;
12071211 },
12081212 typeOf:function( obj ) {
@@ -1382,13 +1386,13 @@
13831387 */
13841388 QUnit.diff = (function() {
13851389 function diff(o, n) {
1386 - var ns = new Object();
1387 - var os = new Object();
 1390+ var ns = {};
 1391+ var os = {};
13881392
13891393 for (var i = 0; i < n.length; i++) {
13901394 if (ns[n[i]] == null)
13911395 ns[n[i]] = {
1392 - rows: new Array(),
 1396+ rows: [],
13931397 o: null
13941398 };
13951399 ns[n[i]].rows.push(i);
@@ -1397,7 +1401,7 @@
13981402 for (var i = 0; i < o.length; i++) {
13991403 if (os[o[i]] == null)
14001404 os[o[i]] = {
1401 - rows: new Array(),
 1405+ rows: [],
14021406 n: null
14031407 };
14041408 os[o[i]].rows.push(i);

Status & tagging log