Index: trunk/phase3/resources/jquery/jquery.qunit.js |
— | — | @@ -453,8 +453,7 @@ |
454 | 454 | // by default, modify document.title when suite is done |
455 | 455 | altertitle: true, |
456 | 456 | |
457 | | - noglobals: false, |
458 | | - notrycatch: false |
| 457 | + urlConfig: ['noglobals', 'notrycatch'] |
459 | 458 | }; |
460 | 459 | |
461 | 460 | // Load paramaters |
— | — | @@ -472,9 +471,6 @@ |
473 | 472 | // allow just a key to turn on a flag, e.g., test.html?noglobals |
474 | 473 | current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; |
475 | 474 | urlParams[ current[ 0 ] ] = current[ 1 ]; |
476 | | - if ( current[ 0 ] in config ) { |
477 | | - config[ current[ 0 ] ] = current[ 1 ]; |
478 | | - } |
479 | 475 | } |
480 | 476 | } |
481 | 477 | |
— | — | @@ -694,15 +690,19 @@ |
695 | 691 | |
696 | 692 | config.blocking = false; |
697 | 693 | |
| 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 | + |
698 | 700 | var userAgent = id("qunit-userAgent"); |
699 | 701 | if ( userAgent ) { |
700 | 702 | userAgent.innerHTML = navigator.userAgent; |
701 | 703 | } |
702 | 704 | var banner = id("qunit-header"); |
703 | 705 | 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; |
707 | 707 | addEvent( banner, "change", function( event ) { |
708 | 708 | var params = {}; |
709 | 709 | params[ event.target.name ] = event.target.checked ? true : undefined; |
— | — | @@ -847,6 +847,10 @@ |
848 | 848 | } else if (e.stack) { |
849 | 849 | // Firefox, Chrome |
850 | 850 | 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; |
851 | 855 | } |
852 | 856 | } |
853 | 857 | } |
— | — | @@ -1198,10 +1202,10 @@ |
1199 | 1203 | if (type == 'function') { |
1200 | 1204 | stack.push(obj); |
1201 | 1205 | var res = parser.call( this, obj, stack ); |
1202 | | - stack.pop(); |
| 1206 | + stack.pop(); |
1203 | 1207 | return res; |
1204 | | - } |
1205 | | - // else |
| 1208 | + } |
| 1209 | + // else |
1206 | 1210 | return (type == 'string') ? parser : this.parsers.error; |
1207 | 1211 | }, |
1208 | 1212 | typeOf:function( obj ) { |
— | — | @@ -1382,13 +1386,13 @@ |
1383 | 1387 | */ |
1384 | 1388 | QUnit.diff = (function() { |
1385 | 1389 | function diff(o, n) { |
1386 | | - var ns = new Object(); |
1387 | | - var os = new Object(); |
| 1390 | + var ns = {}; |
| 1391 | + var os = {}; |
1388 | 1392 | |
1389 | 1393 | for (var i = 0; i < n.length; i++) { |
1390 | 1394 | if (ns[n[i]] == null) |
1391 | 1395 | ns[n[i]] = { |
1392 | | - rows: new Array(), |
| 1396 | + rows: [], |
1393 | 1397 | o: null |
1394 | 1398 | }; |
1395 | 1399 | ns[n[i]].rows.push(i); |
— | — | @@ -1397,7 +1401,7 @@ |
1398 | 1402 | for (var i = 0; i < o.length; i++) { |
1399 | 1403 | if (os[o[i]] == null) |
1400 | 1404 | os[o[i]] = { |
1401 | | - rows: new Array(), |
| 1405 | + rows: [], |
1402 | 1406 | n: null |
1403 | 1407 | }; |
1404 | 1408 | os[o[i]].rows.push(i); |