• R/O
  • SSH
  • HTTPS

aaoh-kaze: Commit


Commit MetaInfo

Revision27 (tree)
Time2011-11-23 22:38:49
Authorfujishiro

Log Message

[aaoh.kaze] [main1]

一段落したのでコミット

Change Summary

Incremental Difference

--- trunk/src/test1/base/qunit/qunit.css (revision 26)
+++ trunk/src/test1/base/qunit/qunit.css (revision 27)
@@ -1,6 +1,6 @@
11 /**
2- * QUnit - A JavaScript Unit Testing Framework
3- *
2+ * QUnit 1.2.0pre - A JavaScript Unit Testing Framework
3+ *
44 * http://docs.jquery.com/QUnit
55 *
66 * Copyright (c) 2011 John Resig, Jörn Zaefferer
@@ -11,7 +11,7 @@
1111 /** Font Family and Sizes */
1212
1313 #qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
14- font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
14+ font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
1515 }
1616
1717 #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
@@ -37,7 +37,7 @@
3737 font-size: 1.5em;
3838 line-height: 1em;
3939 font-weight: normal;
40-
40+
4141 border-radius: 15px 15px 0 0;
4242 -moz-border-radius: 15px 15px 0 0;
4343 -webkit-border-top-right-radius: 15px;
@@ -105,13 +105,13 @@
105105 #qunit-tests ol {
106106 margin-top: 0.5em;
107107 padding: 0.5em;
108-
108+
109109 background-color: #fff;
110-
110+
111111 border-radius: 15px;
112112 -moz-border-radius: 15px;
113113 -webkit-border-radius: 15px;
114-
114+
115115 box-shadow: inset 0px 2px 13px #999;
116116 -moz-box-shadow: inset 0px 2px 13px #999;
117117 -webkit-box-shadow: inset 0px 2px 13px #999;
@@ -174,7 +174,7 @@
174174
175175 #qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
176176 #qunit-tests .pass .test-name { color: #366097; }
177-
177+
178178 #qunit-tests .pass .test-actual,
179179 #qunit-tests .pass .test-expected { color: #999999; }
180180
@@ -186,6 +186,7 @@
186186 color: #710909;
187187 background-color: #fff;
188188 border-left: 26px solid #EE5757;
189+ white-space: pre;
189190 }
190191
191192 #qunit-tests > li:last-child {
--- trunk/src/test1/base/qunit/qunit.js (revision 26)
+++ trunk/src/test1/base/qunit/qunit.js (revision 27)
@@ -1,6 +1,6 @@
11 /**
2- * QUnit - A JavaScript Unit Testing Framework
3- *
2+ * QUnit 1.2.0pre - A JavaScript Unit Testing Framework
3+ *
44 * http://docs.jquery.com/QUnit
55 *
66 * Copyright (c) 2011 John Resig, Jörn Zaefferer
@@ -15,13 +15,15 @@
1515 sessionStorage: (function() {
1616 try {
1717 return !!sessionStorage.getItem;
18- } catch(e){
18+ } catch(e) {
1919 return false;
2020 }
21- })()
21+ })()
2222 };
2323
24-var testId = 0;
24+var testId = 0,
25+ toString = Object.prototype.toString,
26+ hasOwn = Object.prototype.hasOwnProperty;
2527
2628 var Test = function(name, testName, expected, testEnvironmentArg, async, callback) {
2729 this.name = name;
@@ -48,7 +50,7 @@
4850 setup: function() {
4951 if (this.module != config.previousModule) {
5052 if ( config.previousModule ) {
51- QUnit.moduleDone( {
53+ runLoggingCallbacks('moduleDone', QUnit, {
5254 name: config.previousModule,
5355 failed: config.moduleStats.bad,
5456 passed: config.moduleStats.all - config.moduleStats.bad,
@@ -57,7 +59,7 @@
5759 }
5860 config.previousModule = this.module;
5961 config.moduleStats = { all: 0, bad: 0 };
60- QUnit.moduleStart( {
62+ runLoggingCallbacks( 'moduleStart', QUnit, {
6163 name: this.module
6264 } );
6365 }
@@ -71,14 +73,15 @@
7173 extend(this.testEnvironment, this.testEnvironmentArg);
7274 }
7375
74- QUnit.testStart( {
75- name: this.testName
76- } );
76+ runLoggingCallbacks( 'testStart', QUnit, {
77+ name: this.testName,
78+ module: this.module
79+ });
7780
7881 // allow utility functions to access the current test environment
7982 // TODO why??
8083 QUnit.current_testEnvironment = this.testEnvironment;
81-
84+
8285 try {
8386 if ( !config.pollution ) {
8487 saveGlobal();
@@ -90,6 +93,7 @@
9093 }
9194 },
9295 run: function() {
96+ config.current = this;
9397 if ( this.async ) {
9498 QUnit.stop();
9599 }
@@ -108,23 +112,25 @@
108112
109113 // Restart the tests if they're blocking
110114 if ( config.blocking ) {
111- start();
115+ QUnit.start();
112116 }
113117 }
114118 },
115119 teardown: function() {
120+ config.current = this;
116121 try {
122+ this.testEnvironment.teardown.call(this.testEnvironment);
117123 checkPollution();
118- this.testEnvironment.teardown.call(this.testEnvironment);
119124 } catch(e) {
120125 QUnit.ok( false, "Teardown failed on " + this.testName + ": " + e.message );
121126 }
122127 },
123128 finish: function() {
124- if ( this.expected && this.expected != this.assertions.length ) {
129+ config.current = this;
130+ if ( this.expected != null && this.expected != this.assertions.length ) {
125131 QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" );
126132 }
127-
133+
128134 var good = 0, bad = 0,
129135 tests = id("qunit-tests");
130136
@@ -132,7 +138,7 @@
132138 config.moduleStats.all += this.assertions.length;
133139
134140 if ( tests ) {
135- var ol = document.createElement("ol");
141+ var ol = document.createElement("ol");
136142
137143 for ( var i = 0; i < this.assertions.length; i++ ) {
138144 var assertion = this.assertions[i];
@@ -166,17 +172,17 @@
166172
167173 var b = document.createElement("strong");
168174 b.innerHTML = this.name + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>";
169-
175+
170176 var a = document.createElement("a");
171177 a.innerHTML = "Rerun";
172178 a.href = QUnit.url({ filter: getText([b]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") });
173-
179+
174180 addEvent(b, "click", function() {
175181 var next = b.nextSibling.nextSibling,
176182 display = next.style.display;
177183 next.style.display = display === "none" ? "block" : "none";
178184 });
179-
185+
180186 addEvent(b, "dblclick", function(e) {
181187 var target = e && e.target ? e.target : window.event.srcElement;
182188 if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) {
@@ -210,14 +216,15 @@
210216 fail("reset() failed, following Test " + this.testName + ", exception and reset fn follows", e, QUnit.reset);
211217 }
212218
213- QUnit.testDone( {
219+ runLoggingCallbacks( 'testDone', QUnit, {
214220 name: this.testName,
221+ module: this.module,
215222 failed: bad,
216223 passed: this.assertions.length - bad,
217224 total: this.assertions.length
218225 } );
219226 },
220-
227+
221228 queue: function() {
222229 var test = this;
223230 synchronize(function() {
@@ -243,10 +250,10 @@
243250 if (bad) {
244251 run();
245252 } else {
246- synchronize(run);
253+ synchronize(run, true);
247254 };
248255 }
249-
256+
250257 };
251258
252259 var QUnit = {
@@ -260,12 +267,12 @@
260267 asyncTest: function(testName, expected, callback) {
261268 if ( arguments.length === 2 ) {
262269 callback = expected;
263- expected = 0;
270+ expected = null;
264271 }
265272
266273 QUnit.test(testName, expected, callback, true);
267274 },
268-
275+
269276 test: function(testName, expected, callback, async) {
270277 var name = '<span class="test-name">' + testName + '</span>', testEnvironmentArg;
271278
@@ -275,7 +282,7 @@
275282 }
276283 // is 2nd argument a testEnvironment?
277284 if ( expected && typeof expected === 'object') {
278- testEnvironmentArg = expected;
285+ testEnvironmentArg = expected;
279286 expected = null;
280287 }
281288
@@ -286,13 +293,13 @@
286293 if ( !validTest(config.currentModule + ": " + testName) ) {
287294 return;
288295 }
289-
296+
290297 var test = new Test(name, testName, expected, testEnvironmentArg, async, callback);
291298 test.module = config.currentModule;
292299 test.moduleTestEnvironment = config.currentModuleTestEnviroment;
293300 test.queue();
294301 },
295-
302+
296303 /**
297304 * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
298305 */
@@ -310,8 +317,8 @@
310317 result: a,
311318 message: msg
312319 };
313- msg = escapeHtml(msg);
314- QUnit.log(details);
320+ msg = escapeInnerText(msg);
321+ runLoggingCallbacks( 'log', QUnit, details );
315322 config.current.assertions.push({
316323 result: a,
317324 message: msg
@@ -337,7 +344,7 @@
337344 notEqual: function(actual, expected, message) {
338345 QUnit.push(expected != actual, actual, expected, message);
339346 },
340-
347+
341348 deepEqual: function(actual, expected, message) {
342349 QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
343350 },
@@ -356,39 +363,39 @@
356363
357364 raises: function(block, expected, message) {
358365 var actual, ok = false;
359-
366+
360367 if (typeof expected === 'string') {
361368 message = expected;
362369 expected = null;
363370 }
364-
371+
365372 try {
366373 block();
367374 } catch (e) {
368375 actual = e;
369376 }
370-
377+
371378 if (actual) {
372379 // we don't want to validate thrown error
373380 if (!expected) {
374381 ok = true;
375- // expected is a regexp
382+ // expected is a regexp
376383 } else if (QUnit.objectType(expected) === "regexp") {
377384 ok = expected.test(actual);
378- // expected is a constructor
385+ // expected is a constructor
379386 } else if (actual instanceof expected) {
380387 ok = true;
381- // expected is a validation function which returns true is validation passed
388+ // expected is a validation function which returns true is validation passed
382389 } else if (expected.call({}, actual) === true) {
383390 ok = true;
384391 }
385392 }
386-
393+
387394 QUnit.ok(ok, message);
388395 },
389396
390- start: function() {
391- config.semaphore--;
397+ start: function(count) {
398+ config.semaphore -= count || 1;
392399 if (config.semaphore > 0) {
393400 // don't start until equal number of stop-calls
394401 return;
@@ -400,33 +407,46 @@
400407 // A slight delay, to avoid any current callbacks
401408 if ( defined.setTimeout ) {
402409 window.setTimeout(function() {
410+ if (config.semaphore > 0) {
411+ return;
412+ }
403413 if ( config.timeout ) {
404414 clearTimeout(config.timeout);
405415 }
406416
407417 config.blocking = false;
408- process();
418+ process(true);
409419 }, 13);
410420 } else {
411421 config.blocking = false;
412- process();
422+ process(true);
413423 }
414424 },
415-
416- stop: function(timeout) {
417- config.semaphore++;
425+
426+ stop: function(count) {
427+ config.semaphore += count || 1;
418428 config.blocking = true;
419429
420- if ( timeout && defined.setTimeout ) {
430+ if ( config.testTimeout && defined.setTimeout ) {
421431 clearTimeout(config.timeout);
422432 config.timeout = window.setTimeout(function() {
423433 QUnit.ok( false, "Test timed out" );
434+ config.semaphore = 1;
424435 QUnit.start();
425- }, timeout);
436+ }, config.testTimeout);
426437 }
427438 }
428439 };
429440
441+//We want access to the constructor's prototype
442+(function() {
443+ function F(){};
444+ F.prototype = QUnit;
445+ QUnit = new F();
446+ //Make F QUnit's constructor so that we can add to the prototype later
447+ QUnit.constructor = F;
448+})();
449+
430450 // Backwards compatibility, deprecated
431451 QUnit.equals = QUnit.equal;
432452 QUnit.same = QUnit.deepEqual;
@@ -438,13 +458,28 @@
438458
439459 // block until document ready
440460 blocking: true,
441-
461+
462+ // when enabled, show only failing tests
463+ // gets persisted through sessionStorage and can be changed in UI via checkbox
464+ hidepassed: false,
465+
442466 // by default, run previously failed tests first
443467 // very useful in combination with "Hide passed tests" checked
444468 reorder: true,
445469
446- noglobals: false,
447- notrycatch: false
470+ // by default, modify document.title when suite is done
471+ altertitle: true,
472+
473+ urlConfig: ['noglobals', 'notrycatch'],
474+
475+ //logging callback queues
476+ begin: [],
477+ done: [],
478+ log: [],
479+ testStart: [],
480+ testDone: [],
481+ moduleStart: [],
482+ moduleDone: []
448483 };
449484
450485 // Load paramaters
@@ -462,9 +497,6 @@
462497 // allow just a key to turn on a flag, e.g., test.html?noglobals
463498 current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true;
464499 urlParams[ current[ 0 ] ] = current[ 1 ];
465- if ( current[ 0 ] in config ) {
466- config[ current[ 0 ] ] = current[ 1 ];
467- }
468500 }
469501 }
470502
@@ -519,7 +551,7 @@
519551 if ( result ) {
520552 result.parentNode.removeChild( result );
521553 }
522-
554+
523555 if ( tests ) {
524556 result = document.createElement( "p" );
525557 result.id = "qunit-testresult";
@@ -528,10 +560,10 @@
528560 result.innerHTML = 'Running...<br/>&nbsp;';
529561 }
530562 },
531-
563+
532564 /**
533565 * Resets the test setup. Useful for tests that modify the DOM.
534- *
566+ *
535567 * If jQuery is available, uses jQuery's html(), otherwise just innerHTML.
536568 */
537569 reset: function() {
@@ -544,7 +576,7 @@
544576 }
545577 }
546578 },
547-
579+
548580 /**
549581 * Trigger an event on an element.
550582 *
@@ -564,12 +596,12 @@
564596 elem.fireEvent("on"+type);
565597 }
566598 },
567-
599+
568600 // Safe object type checking
569601 is: function( type, obj ) {
570602 return QUnit.objectType( obj ) == type;
571603 },
572-
604+
573605 objectType: function( obj ) {
574606 if (typeof obj === "undefined") {
575607 return "undefined";
@@ -580,8 +612,7 @@
580612 return "null";
581613 }
582614
583- var type = Object.prototype.toString.call( obj )
584- .match(/^\[object\s(.*)\]$/)[1] || '';
615+ var type = toString.call( obj ).match(/^\[object\s(.*)\]$/)[1] || '';
585616
586617 switch (type) {
587618 case 'Number':
@@ -603,7 +634,7 @@
603634 }
604635 return undefined;
605636 },
606-
637+
607638 push: function(result, actual, expected, message) {
608639 var details = {
609640 result: result,
@@ -611,11 +642,11 @@
611642 actual: actual,
612643 expected: expected
613644 };
614-
615- message = escapeHtml(message) || (result ? "okay" : "failed");
645+
646+ message = escapeInnerText(message) || (result ? "okay" : "failed");
616647 message = '<span class="test-message">' + message + "</span>";
617- expected = escapeHtml(QUnit.jsDump.parse(expected));
618- actual = escapeHtml(QUnit.jsDump.parse(actual));
648+ expected = escapeInnerText(QUnit.jsDump.parse(expected));
649+ actual = escapeInnerText(QUnit.jsDump.parse(actual));
619650 var output = message + '<table><tr class="test-expected"><th>Expected: </th><td><pre>' + expected + '</pre></td></tr>';
620651 if (actual != expected) {
621652 output += '<tr class="test-actual"><th>Result: </th><td><pre>' + actual + '</pre></td></tr>';
@@ -625,45 +656,57 @@
625656 var source = sourceFromStacktrace();
626657 if (source) {
627658 details.source = source;
628- output += '<tr class="test-source"><th>Source: </th><td><pre>' + source +'</pre></td></tr>';
659+ output += '<tr class="test-source"><th>Source: </th><td><pre>' + escapeInnerText(source) + '</pre></td></tr>';
629660 }
630661 }
631662 output += "</table>";
632-
633- QUnit.log(details);
634-
663+
664+ runLoggingCallbacks( 'log', QUnit, details );
665+
635666 config.current.assertions.push({
636667 result: !!result,
637668 message: output
638669 });
639670 },
640-
671+
641672 url: function( params ) {
642673 params = extend( extend( {}, QUnit.urlParams ), params );
643674 var querystring = "?",
644675 key;
645676 for ( key in params ) {
677+ if ( !hasOwn.call( params, key ) ) {
678+ continue;
679+ }
646680 querystring += encodeURIComponent( key ) + "=" +
647681 encodeURIComponent( params[ key ] ) + "&";
648682 }
649683 return window.location.pathname + querystring.slice( 0, -1 );
650684 },
651-
685+
686+ extend: extend,
687+ id: id,
688+ addEvent: addEvent
689+});
690+
691+//QUnit.constructor is set to the empty F() above so that we can add to it's prototype later
692+//Doing this allows us to tell if the following methods have been overwritten on the actual
693+//QUnit object, which is a deprecated way of using the callbacks.
694+extend(QUnit.constructor.prototype, {
652695 // Logging callbacks; all receive a single argument with the listed properties
653696 // run test/logs.html for any related changes
654- begin: function() {},
697+ begin: registerLoggingCallback('begin'),
655698 // done: { failed, passed, total, runtime }
656- done: function() {},
699+ done: registerLoggingCallback('done'),
657700 // log: { result, actual, expected, message }
658- log: function() {},
701+ log: registerLoggingCallback('log'),
659702 // testStart: { name }
660- testStart: function() {},
703+ testStart: registerLoggingCallback('testStart'),
661704 // testDone: { name, failed, passed, total }
662- testDone: function() {},
705+ testDone: registerLoggingCallback('testDone'),
663706 // moduleStart: { name }
664- moduleStart: function() {},
707+ moduleStart: registerLoggingCallback('moduleStart'),
665708 // moduleDone: { name, failed, passed, total }
666- moduleDone: function() {}
709+ moduleDone: registerLoggingCallback('moduleDone')
667710 });
668711
669712 if ( typeof document === "undefined" || document.readyState === "complete" ) {
@@ -670,9 +713,9 @@
670713 config.autorun = true;
671714 }
672715
673-addEvent(window, "load", function() {
674- QUnit.begin({});
675-
716+QUnit.load = function() {
717+ runLoggingCallbacks( 'begin', QUnit, {} );
718+
676719 // Initialize the config, saving the execution queue
677720 var oldconfig = extend({}, config);
678721 QUnit.init();
@@ -680,6 +723,12 @@
680723
681724 config.blocking = false;
682725
726+ var urlConfigHtml = '', len = config.urlConfig.length;
727+ for ( var i = 0, val; i < len, val = config.urlConfig[i]; i++ ) {
728+ config[val] = QUnit.urlParams[val];
729+ urlConfigHtml += '<label><input name="' + val + '" type="checkbox"' + ( config[val] ? ' checked="checked"' : '' ) + '>' + val + '</label>';
730+ }
731+
683732 var userAgent = id("qunit-userAgent");
684733 if ( userAgent ) {
685734 userAgent.innerHTML = navigator.userAgent;
@@ -686,9 +735,7 @@
686735 }
687736 var banner = id("qunit-header");
688737 if ( banner ) {
689- banner.innerHTML = '<a href="' + QUnit.url({ filter: undefined }) + '"> ' + banner.innerHTML + '</a> ' +
690- '<label><input name="noglobals" type="checkbox"' + ( config.noglobals ? ' checked="checked"' : '' ) + '>noglobals</label>' +
691- '<label><input name="notrycatch" type="checkbox"' + ( config.notrycatch ? ' checked="checked"' : '' ) + '>notrycatch</label>';
738+ banner.innerHTML = '<a href="' + QUnit.url({ filter: undefined }) + '"> ' + banner.innerHTML + '</a> ' + urlConfigHtml;
692739 addEvent( banner, "change", function( event ) {
693740 var params = {};
694741 params[ event.target.name ] = event.target.checked ? true : undefined;
@@ -695,7 +742,7 @@
695742 window.location = QUnit.url( params );
696743 });
697744 }
698-
745+
699746 var toolbar = id("qunit-testrunner-toolbar");
700747 if ( toolbar ) {
701748 var filter = document.createElement("input");
@@ -711,13 +758,13 @@
711758 }
712759 if ( defined.sessionStorage ) {
713760 if (filter.checked) {
714- sessionStorage.setItem("qunit-filter-passed-tests", "true");
761+ sessionStorage.setItem("qunit-filter-passed-tests", "true");
715762 } else {
716763 sessionStorage.removeItem("qunit-filter-passed-tests");
717764 }
718765 }
719766 });
720- if ( defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) {
767+ if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) {
721768 filter.checked = true;
722769 var ol = document.getElementById("qunit-tests");
723770 ol.className = ol.className + " hidepass";
@@ -738,14 +785,27 @@
738785 if (config.autostart) {
739786 QUnit.start();
740787 }
741-});
788+};
742789
790+addEvent(window, "load", QUnit.load);
791+
792+// addEvent(window, "error") gives us a useless event object
793+window.onerror = function( message, file, line ) {
794+ if ( QUnit.config.current ) {
795+ ok( false, message + ", " + file + ":" + line );
796+ } else {
797+ test( "global failure", function() {
798+ ok( false, message + ", " + file + ":" + line );
799+ });
800+ }
801+};
802+
743803 function done() {
744804 config.autorun = true;
745805
746806 // Log the last module results
747807 if ( config.currentModule ) {
748- QUnit.moduleDone( {
808+ runLoggingCallbacks( 'moduleDone', QUnit, {
749809 name: config.currentModule,
750810 failed: config.moduleStats.bad,
751811 passed: config.moduleStats.all - config.moduleStats.bad,
@@ -774,13 +834,22 @@
774834 banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass");
775835 }
776836
777- if ( tests ) {
837+ if ( tests ) {
778838 id( "qunit-testresult" ).innerHTML = html;
779839 }
780840
781- QUnit.done( {
841+ if ( config.altertitle && typeof document !== "undefined" && document.title ) {
842+ // show ✖ for good, ✔ for bad suite result in title
843+ // use escape sequences in case file gets loaded with non-utf-8-charset
844+ document.title = [
845+ (config.stats.bad ? "\u2716" : "\u2714"),
846+ document.title.replace(/^[\u2714\u2716] /i, "")
847+ ].join(" ");
848+ }
849+
850+ runLoggingCallbacks( 'done', QUnit, {
782851 failed: config.stats.bad,
783- passed: passed,
852+ passed: passed,
784853 total: config.stats.all,
785854 runtime: runtime
786855 } );
@@ -794,7 +863,7 @@
794863 return true;
795864 }
796865
797- not = filter.charAt( 0 ) === "!";
866+ var not = filter.charAt( 0 ) === "!";
798867 if ( not ) {
799868 filter = filter.slice( 1 );
800869 }
@@ -822,20 +891,22 @@
822891 } else if (e.stack) {
823892 // Firefox, Chrome
824893 return e.stack.split("\n")[4];
894+ } else if (e.sourceURL) {
895+ // Safari, PhantomJS
896+ // TODO sourceURL points at the 'throw new Error' line above, useless
897+ //return e.sourceURL + ":" + e.line;
825898 }
826899 }
827900 }
828901
829-function escapeHtml(s) {
902+function escapeInnerText(s) {
830903 if (!s) {
831904 return "";
832905 }
833906 s = s + "";
834- return s.replace(/[\&"<>\\]/g, function(s) {
907+ return s.replace(/[\&<>]/g, function(s) {
835908 switch(s) {
836909 case "&": return "&amp;";
837- case "\\": return "\\\\";
838- case '"': return '\"';
839910 case "<": return "&lt;";
840911 case ">": return "&gt;";
841912 default: return s;
@@ -843,35 +914,42 @@
843914 });
844915 }
845916
846-function synchronize( callback ) {
917+function synchronize( callback, last ) {
847918 config.queue.push( callback );
848919
849920 if ( config.autorun && !config.blocking ) {
850- process();
921+ process(last);
851922 }
852923 }
853924
854-function process() {
855- var start = (new Date()).getTime();
925+function process( last ) {
926+ var start = new Date().getTime();
927+ config.depth = config.depth ? config.depth + 1 : 1;
856928
857929 while ( config.queue.length && !config.blocking ) {
858- if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) {
930+ if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) {
859931 config.queue.shift()();
860932 } else {
861- window.setTimeout( process, 13 );
933+ window.setTimeout( function(){
934+ process( last );
935+ }, 13 );
862936 break;
863937 }
864938 }
865- if (!config.blocking && !config.queue.length) {
866- done();
867- }
939+ config.depth--;
940+ if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) {
941+ done();
942+ }
868943 }
869944
870945 function saveGlobal() {
871946 config.pollution = [];
872-
947+
873948 if ( config.noglobals ) {
874949 for ( var key in window ) {
950+ if ( !hasOwn.call( window, key ) ) {
951+ continue;
952+ }
875953 config.pollution.push( key );
876954 }
877955 }
@@ -880,7 +958,7 @@
880958 function checkPollution( name ) {
881959 var old = config.pollution;
882960 saveGlobal();
883-
961+
884962 var newGlobals = diff( config.pollution, old );
885963 if ( newGlobals.length > 0 ) {
886964 ok( false, "Introduced global variable(s): " + newGlobals.join(", ") );
@@ -922,7 +1000,9 @@
9221000 for ( var prop in b ) {
9231001 if ( b[prop] === undefined ) {
9241002 delete a[prop];
925- } else {
1003+
1004+ // Avoid "Member not found" error in IE8 caused by setting window.constructor
1005+ } else if ( prop !== "constructor" || a !== window ) {
9261006 a[prop] = b[prop];
9271007 }
9281008 }
@@ -945,176 +1025,216 @@
9451025 document.getElementById( name );
9461026 }
9471027
1028+function registerLoggingCallback(key){
1029+ return function(callback){
1030+ config[key].push( callback );
1031+ };
1032+}
1033+
1034+// Supports deprecated method of completely overwriting logging callbacks
1035+function runLoggingCallbacks(key, scope, args) {
1036+ //debugger;
1037+ var callbacks;
1038+ if ( QUnit.hasOwnProperty(key) ) {
1039+ QUnit[key].call(scope, args);
1040+ } else {
1041+ callbacks = config[key];
1042+ for( var i = 0; i < callbacks.length; i++ ) {
1043+ callbacks[i].call( scope, args );
1044+ }
1045+ }
1046+}
1047+
9481048 // Test for equality any JavaScript type.
949-// Discussions and reference: http://philrathe.com/articles/equiv
950-// Test suites: http://philrathe.com/tests/equiv
9511049 // Author: Philippe Rathé <prathe@gmail.com>
9521050 QUnit.equiv = function () {
9531051
954- var innerEquiv; // the real equiv function
955- var callers = []; // stack to decide between skip/abort functions
956- var parents = []; // stack to avoiding loops from circular referencing
1052+ var innerEquiv; // the real equiv function
1053+ var callers = []; // stack to decide between skip/abort functions
1054+ var parents = []; // stack to avoiding loops from circular referencing
9571055
958- // Call the o related callback with the given arguments.
959- function bindCallbacks(o, callbacks, args) {
960- var prop = QUnit.objectType(o);
961- if (prop) {
962- if (QUnit.objectType(callbacks[prop]) === "function") {
963- return callbacks[prop].apply(callbacks, args);
964- } else {
965- return callbacks[prop]; // or undefined
966- }
967- }
968- }
969-
970- var callbacks = function () {
1056+ // Call the o related callback with the given arguments.
1057+ function bindCallbacks(o, callbacks, args) {
1058+ var prop = QUnit.objectType(o);
1059+ if (prop) {
1060+ if (QUnit.objectType(callbacks[prop]) === "function") {
1061+ return callbacks[prop].apply(callbacks, args);
1062+ } else {
1063+ return callbacks[prop]; // or undefined
1064+ }
1065+ }
1066+ }
9711067
972- // for string, boolean, number and null
973- function useStrictEquality(b, a) {
974- if (b instanceof a.constructor || a instanceof b.constructor) {
975- // to catch short annotaion VS 'new' annotation of a declaration
976- // e.g. var i = 1;
977- // var j = new Number(1);
978- return a == b;
979- } else {
980- return a === b;
981- }
982- }
1068+ var getProto = Object.getPrototypeOf || function (obj) {
1069+ return obj.__proto__;
1070+ };
9831071
984- return {
985- "string": useStrictEquality,
986- "boolean": useStrictEquality,
987- "number": useStrictEquality,
988- "null": useStrictEquality,
989- "undefined": useStrictEquality,
1072+ var callbacks = function () {
9901073
991- "nan": function (b) {
992- return isNaN(b);
993- },
1074+ // for string, boolean, number and null
1075+ function useStrictEquality(b, a) {
1076+ if (b instanceof a.constructor || a instanceof b.constructor) {
1077+ // to catch short annotaion VS 'new' annotation of a
1078+ // declaration
1079+ // e.g. var i = 1;
1080+ // var j = new Number(1);
1081+ return a == b;
1082+ } else {
1083+ return a === b;
1084+ }
1085+ }
9941086
995- "date": function (b, a) {
996- return QUnit.objectType(b) === "date" && a.valueOf() === b.valueOf();
997- },
1087+ return {
1088+ "string" : useStrictEquality,
1089+ "boolean" : useStrictEquality,
1090+ "number" : useStrictEquality,
1091+ "null" : useStrictEquality,
1092+ "undefined" : useStrictEquality,
9981093
999- "regexp": function (b, a) {
1000- return QUnit.objectType(b) === "regexp" &&
1001- a.source === b.source && // the regex itself
1002- a.global === b.global && // and its modifers (gmi) ...
1003- a.ignoreCase === b.ignoreCase &&
1004- a.multiline === b.multiline;
1005- },
1094+ "nan" : function(b) {
1095+ return isNaN(b);
1096+ },
10061097
1007- // - skip when the property is a method of an instance (OOP)
1008- // - abort otherwise,
1009- // initial === would have catch identical references anyway
1010- "function": function () {
1011- var caller = callers[callers.length - 1];
1012- return caller !== Object &&
1013- typeof caller !== "undefined";
1014- },
1098+ "date" : function(b, a) {
1099+ return QUnit.objectType(b) === "date"
1100+ && a.valueOf() === b.valueOf();
1101+ },
10151102
1016- "array": function (b, a) {
1017- var i, j, loop;
1018- var len;
1103+ "regexp" : function(b, a) {
1104+ return QUnit.objectType(b) === "regexp"
1105+ && a.source === b.source && // the regex itself
1106+ a.global === b.global && // and its modifers
1107+ // (gmi) ...
1108+ a.ignoreCase === b.ignoreCase
1109+ && a.multiline === b.multiline;
1110+ },
10191111
1020- // b could be an object literal here
1021- if ( ! (QUnit.objectType(b) === "array")) {
1022- return false;
1023- }
1024-
1025- len = a.length;
1026- if (len !== b.length) { // safe and faster
1027- return false;
1028- }
1029-
1030- //track reference to avoid circular references
1031- parents.push(a);
1032- for (i = 0; i < len; i++) {
1033- loop = false;
1034- for(j=0;j<parents.length;j++){
1035- if(parents[j] === a[i]){
1036- loop = true;//dont rewalk array
1037- }
1038- }
1039- if (!loop && ! innerEquiv(a[i], b[i])) {
1040- parents.pop();
1041- return false;
1042- }
1043- }
1044- parents.pop();
1045- return true;
1046- },
1112+ // - skip when the property is a method of an instance (OOP)
1113+ // - abort otherwise,
1114+ // initial === would have catch identical references anyway
1115+ "function" : function() {
1116+ var caller = callers[callers.length - 1];
1117+ return caller !== Object && typeof caller !== "undefined";
1118+ },
10471119
1048- "object": function (b, a) {
1049- var i, j, loop;
1050- var eq = true; // unless we can proove it
1051- var aProperties = [], bProperties = []; // collection of strings
1120+ "array" : function(b, a) {
1121+ var i, j, loop;
1122+ var len;
10521123
1053- // comparing constructors is more strict than using instanceof
1054- if ( a.constructor !== b.constructor) {
1055- return false;
1056- }
1124+ // b could be an object literal here
1125+ if (!(QUnit.objectType(b) === "array")) {
1126+ return false;
1127+ }
10571128
1058- // stack constructor before traversing properties
1059- callers.push(a.constructor);
1060- //track reference to avoid circular references
1061- parents.push(a);
1062-
1063- for (i in a) { // be strict: don't ensures hasOwnProperty and go deep
1064- loop = false;
1065- for(j=0;j<parents.length;j++){
1066- if(parents[j] === a[i])
1067- loop = true; //don't go down the same path twice
1068- }
1069- aProperties.push(i); // collect a's properties
1129+ len = a.length;
1130+ if (len !== b.length) { // safe and faster
1131+ return false;
1132+ }
10701133
1071- if (!loop && ! innerEquiv(a[i], b[i])) {
1072- eq = false;
1073- break;
1074- }
1075- }
1134+ // track reference to avoid circular references
1135+ parents.push(a);
1136+ for (i = 0; i < len; i++) {
1137+ loop = false;
1138+ for (j = 0; j < parents.length; j++) {
1139+ if (parents[j] === a[i]) {
1140+ loop = true;// dont rewalk array
1141+ }
1142+ }
1143+ if (!loop && !innerEquiv(a[i], b[i])) {
1144+ parents.pop();
1145+ return false;
1146+ }
1147+ }
1148+ parents.pop();
1149+ return true;
1150+ },
10761151
1077- callers.pop(); // unstack, we are done
1078- parents.pop();
1152+ "object" : function(b, a) {
1153+ var i, j, loop;
1154+ var eq = true; // unless we can proove it
1155+ var aProperties = [], bProperties = []; // collection of
1156+ // strings
10791157
1080- for (i in b) {
1081- bProperties.push(i); // collect b's properties
1082- }
1158+ // comparing constructors is more strict than using
1159+ // instanceof
1160+ if (a.constructor !== b.constructor) {
1161+ // Allow objects with no prototype to be equivalent to
1162+ // objects with Object as their constructor.
1163+ if (!((getProto(a) === null && getProto(b) === Object.prototype) ||
1164+ (getProto(b) === null && getProto(a) === Object.prototype)))
1165+ {
1166+ return false;
1167+ }
1168+ }
10831169
1084- // Ensures identical properties name
1085- return eq && innerEquiv(aProperties.sort(), bProperties.sort());
1086- }
1087- };
1088- }();
1170+ // stack constructor before traversing properties
1171+ callers.push(a.constructor);
1172+ // track reference to avoid circular references
1173+ parents.push(a);
10891174
1090- innerEquiv = function () { // can take multiple arguments
1091- var args = Array.prototype.slice.apply(arguments);
1092- if (args.length < 2) {
1093- return true; // end transition
1094- }
1175+ for (i in a) { // be strict: don't ensures hasOwnProperty
1176+ // and go deep
1177+ loop = false;
1178+ for (j = 0; j < parents.length; j++) {
1179+ if (parents[j] === a[i])
1180+ loop = true; // don't go down the same path
1181+ // twice
1182+ }
1183+ aProperties.push(i); // collect a's properties
10951184
1096- return (function (a, b) {
1097- if (a === b) {
1098- return true; // catch the most you can
1099- } else if (a === null || b === null || typeof a === "undefined" || typeof b === "undefined" || QUnit.objectType(a) !== QUnit.objectType(b)) {
1100- return false; // don't lose time with error prone cases
1101- } else {
1102- return bindCallbacks(a, callbacks, [b, a]);
1103- }
1185+ if (!loop && !innerEquiv(a[i], b[i])) {
1186+ eq = false;
1187+ break;
1188+ }
1189+ }
11041190
1105- // apply transition with (1..n) arguments
1106- })(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length -1));
1107- };
1191+ callers.pop(); // unstack, we are done
1192+ parents.pop();
11081193
1109- return innerEquiv;
1194+ for (i in b) {
1195+ bProperties.push(i); // collect b's properties
1196+ }
11101197
1198+ // Ensures identical properties name
1199+ return eq
1200+ && innerEquiv(aProperties.sort(), bProperties
1201+ .sort());
1202+ }
1203+ };
1204+ }();
1205+
1206+ innerEquiv = function() { // can take multiple arguments
1207+ var args = Array.prototype.slice.apply(arguments);
1208+ if (args.length < 2) {
1209+ return true; // end transition
1210+ }
1211+
1212+ return (function(a, b) {
1213+ if (a === b) {
1214+ return true; // catch the most you can
1215+ } else if (a === null || b === null || typeof a === "undefined"
1216+ || typeof b === "undefined"
1217+ || QUnit.objectType(a) !== QUnit.objectType(b)) {
1218+ return false; // don't lose time with error prone cases
1219+ } else {
1220+ return bindCallbacks(a, callbacks, [ b, a ]);
1221+ }
1222+
1223+ // apply transition with (1..n) arguments
1224+ })(args[0], args[1])
1225+ && arguments.callee.apply(this, args.splice(1,
1226+ args.length - 1));
1227+ };
1228+
1229+ return innerEquiv;
1230+
11111231 }();
11121232
11131233 /**
1114- * jsDump
1115- * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
1116- * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
1117- * Date: 5/15/2008
1234+ * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com |
1235+ * http://flesler.blogspot.com Licensed under BSD
1236+ * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008
1237+ *
11181238 * @projectDescription Advanced and extensible data dumping for Javascript.
11191239 * @version 1.0.0
11201240 * @author Ariel Flesler
@@ -1125,7 +1245,7 @@
11251245 return '"' + str.toString().replace(/"/g, '\\"') + '"';
11261246 };
11271247 function literal( o ) {
1128- return o + '';
1248+ return o + '';
11291249 };
11301250 function join( pre, arr, post ) {
11311251 var s = jsDump.separator(),
@@ -1137,25 +1257,35 @@
11371257 return pre + post;
11381258 return [ pre, inner + arr, base + post ].join(s);
11391259 };
1140- function array( arr ) {
1141- var i = arr.length, ret = Array(i);
1260+ function array( arr, stack ) {
1261+ var i = arr.length, ret = Array(i);
11421262 this.up();
11431263 while ( i-- )
1144- ret[i] = this.parse( arr[i] );
1264+ ret[i] = this.parse( arr[i] , undefined , stack);
11451265 this.down();
11461266 return join( '[', ret, ']' );
11471267 };
1148-
1268+
11491269 var reName = /^function (\w+)/;
1150-
1270+
11511271 var jsDump = {
1152- parse:function( obj, type ) { //type is used mostly internally, you can fix a (custom)type in advance
1153- var parser = this.parsers[ type || this.typeOf(obj) ];
1154- type = typeof parser;
1155-
1156- return type == 'function' ? parser.call( this, obj ) :
1157- type == 'string' ? parser :
1158- this.parsers.error;
1272+ parse:function( obj, type, stack ) { //type is used mostly internally, you can fix a (custom)type in advance
1273+ stack = stack || [ ];
1274+ var parser = this.parsers[ type || this.typeOf(obj) ];
1275+ type = typeof parser;
1276+ var inStack = inArray(obj, stack);
1277+ if (inStack != -1) {
1278+ return 'recursion('+(inStack - stack.length)+')';
1279+ }
1280+ //else
1281+ if (type == 'function') {
1282+ stack.push(obj);
1283+ var res = parser.call( this, obj, stack );
1284+ stack.pop();
1285+ return res;
1286+ }
1287+ // else
1288+ return (type == 'string') ? parser : this.parsers.error;
11591289 },
11601290 typeOf:function( obj ) {
11611291 var type;
@@ -1175,7 +1305,12 @@
11751305 type = "document";
11761306 } else if (obj.nodeType) {
11771307 type = "node";
1178- } else if (typeof obj === "object" && typeof obj.length === "number" && obj.length >= 0) {
1308+ } else if (
1309+ // native arrays
1310+ toString.call( obj ) === "[object Array]" ||
1311+ // NodeList objects
1312+ ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) )
1313+ ) {
11791314 type = "array";
11801315 } else {
11811316 type = typeof obj;
@@ -1203,7 +1338,7 @@
12031338 this.parsers[name] = parser;
12041339 },
12051340 // The next 3 are exposed so you can use them
1206- quote:quote,
1341+ quote:quote,
12071342 literal:literal,
12081343 join:join,
12091344 //
@@ -1222,7 +1357,7 @@
12221357 if ( name )
12231358 ret += ' ' + name;
12241359 ret += '(';
1225-
1360+
12261361 ret = [ ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join('');
12271362 return join( ret, QUnit.jsDump.parse(fn,'functionCode'), '}' );
12281363 },
@@ -1229,11 +1364,13 @@
12291364 array: array,
12301365 nodelist: array,
12311366 arguments: array,
1232- object:function( map ) {
1367+ object:function( map, stack ) {
12331368 var ret = [ ];
12341369 QUnit.jsDump.up();
1235- for ( var key in map )
1236- ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(map[key]) );
1370+ for ( var key in map ) {
1371+ var val = map[key];
1372+ ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(val, undefined, stack));
1373+ }
12371374 QUnit.jsDump.down();
12381375 return join( '{', ret, '}' );
12391376 },
@@ -1240,10 +1377,10 @@
12401377 node:function( node ) {
12411378 var open = QUnit.jsDump.HTML ? '&lt;' : '<',
12421379 close = QUnit.jsDump.HTML ? '&gt;' : '>';
1243-
1380+
12441381 var tag = node.nodeName.toLowerCase(),
12451382 ret = open + tag;
1246-
1383+
12471384 for ( var a in QUnit.jsDump.DOMAttrs ) {
12481385 var val = node[QUnit.jsDump.DOMAttrs[a]];
12491386 if ( val )
@@ -1253,8 +1390,8 @@
12531390 },
12541391 functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function
12551392 var l = fn.length;
1256- if ( !l ) return '';
1257-
1393+ if ( !l ) return '';
1394+
12581395 var args = Array(l);
12591396 while ( l-- )
12601397 args[l] = String.fromCharCode(97+l);//97 is 'a'
@@ -1302,6 +1439,21 @@
13021439 return ret;
13031440 };
13041441
1442+//from jquery.js
1443+function inArray( elem, array ) {
1444+ if ( array.indexOf ) {
1445+ return array.indexOf( elem );
1446+ }
1447+
1448+ for ( var i = 0, length = array.length; i < length; i++ ) {
1449+ if ( array[ i ] === elem ) {
1450+ return i;
1451+ }
1452+ }
1453+
1454+ return -1;
1455+}
1456+
13051457 /*
13061458 * Javascript Diff Algorithm
13071459 * By John Resig (http://ejohn.org/)
@@ -1311,35 +1463,38 @@
13111463 *
13121464 * More Info:
13131465 * http://ejohn.org/projects/javascript-diff-algorithm/
1314- *
1466+ *
13151467 * Usage: QUnit.diff(expected, actual)
1316- *
1468+ *
13171469 * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over"
13181470 */
13191471 QUnit.diff = (function() {
1320- function diff(o, n){
1321- var ns = new Object();
1322- var os = new Object();
1323-
1472+ function diff(o, n) {
1473+ var ns = {};
1474+ var os = {};
1475+
13241476 for (var i = 0; i < n.length; i++) {
1325- if (ns[n[i]] == null)
1477+ if (ns[n[i]] == null)
13261478 ns[n[i]] = {
1327- rows: new Array(),
1479+ rows: [],
13281480 o: null
13291481 };
13301482 ns[n[i]].rows.push(i);
13311483 }
1332-
1484+
13331485 for (var i = 0; i < o.length; i++) {
1334- if (os[o[i]] == null)
1486+ if (os[o[i]] == null)
13351487 os[o[i]] = {
1336- rows: new Array(),
1488+ rows: [],
13371489 n: null
13381490 };
13391491 os[o[i]].rows.push(i);
13401492 }
1341-
1493+
13421494 for (var i in ns) {
1495+ if ( !hasOwn.call( ns, i ) ) {
1496+ continue;
1497+ }
13431498 if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) {
13441499 n[ns[i].rows[0]] = {
13451500 text: n[ns[i].rows[0]],
@@ -1351,7 +1506,7 @@
13511506 };
13521507 }
13531508 }
1354-
1509+
13551510 for (var i = 0; i < n.length - 1; i++) {
13561511 if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null &&
13571512 n[i + 1] == o[n[i].row + 1]) {
@@ -1365,7 +1520,7 @@
13651520 };
13661521 }
13671522 }
1368-
1523+
13691524 for (var i = n.length - 1; i > 0; i--) {
13701525 if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null &&
13711526 n[i - 1] == o[n[i].row - 1]) {
@@ -1379,20 +1534,20 @@
13791534 };
13801535 }
13811536 }
1382-
1537+
13831538 return {
13841539 o: o,
13851540 n: n
13861541 };
13871542 }
1388-
1389- return function(o, n){
1543+
1544+ return function(o, n) {
13901545 o = o.replace(/\s+$/, '');
13911546 n = n.replace(/\s+$/, '');
13921547 var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/));
13931548
13941549 var str = "";
1395-
1550+
13961551 var oSpace = o.match(/\s+/g);
13971552 if (oSpace == null) {
13981553 oSpace = [" "];
@@ -1407,7 +1562,7 @@
14071562 else {
14081563 nSpace.push(" ");
14091564 }
1410-
1565+
14111566 if (out.n.length == 0) {
14121567 for (var i = 0; i < out.o.length; i++) {
14131568 str += '<del>' + out.o[i] + oSpace[i] + "</del>";
@@ -1419,7 +1574,7 @@
14191574 str += '<del>' + out.o[n] + oSpace[n] + "</del>";
14201575 }
14211576 }
1422-
1577+
14231578 for (var i = 0; i < out.n.length; i++) {
14241579 if (out.n[i].text == null) {
14251580 str += '<ins>' + out.n[i] + nSpace[i] + "</ins>";
@@ -1426,7 +1581,7 @@
14261581 }
14271582 else {
14281583 var pre = "";
1429-
1584+
14301585 for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++) {
14311586 pre += '<del>' + out.o[n] + oSpace[n] + "</del>";
14321587 }
@@ -1434,7 +1589,7 @@
14341589 }
14351590 }
14361591 }
1437-
1592+
14381593 return str;
14391594 };
14401595 })();
--- trunk/src/test1/base/js/aaoh.kaze-core-test.js (revision 26)
+++ trunk/src/test1/base/js/aaoh.kaze-core-test.js (revision 27)
@@ -1016,8 +1016,8 @@
10161016 test('setLocale', function() {
10171017 var locale = new aaoh.kaze.Locale();
10181018
1019- locale.setLocale('en', function(){
1020- });
1019+ //locale.setLocale('en', function(){
1020+ //});
10211021 locale.setLocale('ja', function(){
10221022 });
10231023 ok('setLocaleの設定確認');
--- trunk/src/main1/lib/json2.js (revision 26)
+++ trunk/src/main1/lib/json2.js (revision 27)
@@ -1,6 +1,6 @@
11 /*
22 http://www.JSON.org/json2.js
3- 2008-11-19
3+ 2011-10-19
44
55 Public Domain.
66
@@ -8,6 +8,14 @@
88
99 See http://www.JSON.org/js.html
1010
11+
12+ This code should be minified before deployment.
13+ See http://javascript.crockford.com/jsmin.html
14+
15+ USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
16+ NOT CONTROL.
17+
18+
1119 This file creates a global JSON object containing two methods: stringify
1220 and parse.
1321
@@ -33,7 +41,7 @@
3341 value represented by the name/value pair that should be serialized,
3442 or undefined if nothing should be serialized. The toJSON method
3543 will be passed the key associated with the value, and this will be
36- bound to the object holding the key.
44+ bound to the value
3745
3846 For example, this would serialize Dates as ISO strings.
3947
@@ -136,18 +144,10 @@
136144
137145 This is a reference implementation. You are free to copy, modify, or
138146 redistribute.
139-
140- This code should be minified before deployment.
141- See http://javascript.crockford.com/jsmin.html
142-
143- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
144- NOT CONTROL.
145147 */
146148
147-/*jslint evil: true */
149+/*jslint evil: true, regexp: true */
148150
149-/*global JSON */
150-
151151 /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
152152 call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
153153 getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
@@ -155,13 +155,17 @@
155155 test, toJSON, toString, valueOf
156156 */
157157
158+
158159 // Create a JSON object only if one does not already exist. We create the
159160 // methods in a closure to avoid creating global variables.
160161
161-if (!this.JSON) {
162+var JSON;
163+if (!JSON) {
162164 JSON = {};
163165 }
166+
164167 (function () {
168+ 'use strict';
165169
166170 function f(n) {
167171 // Format integers to have at least two digits.
@@ -172,19 +176,21 @@
172176
173177 Date.prototype.toJSON = function (key) {
174178
175- return this.getUTCFullYear() + '-' +
176- f(this.getUTCMonth() + 1) + '-' +
177- f(this.getUTCDate()) + 'T' +
178- f(this.getUTCHours()) + ':' +
179- f(this.getUTCMinutes()) + ':' +
180- f(this.getUTCSeconds()) + 'Z';
179+ return isFinite(this.valueOf())
180+ ? this.getUTCFullYear() + '-' +
181+ f(this.getUTCMonth() + 1) + '-' +
182+ f(this.getUTCDate()) + 'T' +
183+ f(this.getUTCHours()) + ':' +
184+ f(this.getUTCMinutes()) + ':' +
185+ f(this.getUTCSeconds()) + 'Z'
186+ : null;
181187 };
182188
183- String.prototype.toJSON =
184- Number.prototype.toJSON =
185- Boolean.prototype.toJSON = function (key) {
186- return this.valueOf();
187- };
189+ String.prototype.toJSON =
190+ Number.prototype.toJSON =
191+ Boolean.prototype.toJSON = function (key) {
192+ return this.valueOf();
193+ };
188194 }
189195
190196 var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
@@ -211,13 +217,12 @@
211217 // sequences.
212218
213219 escapable.lastIndex = 0;
214- return escapable.test(string) ?
215- '"' + string.replace(escapable, function (a) {
216- var c = meta[a];
217- return typeof c === 'string' ? c :
218- '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
219- }) + '"' :
220- '"' + string + '"';
220+ return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
221+ var c = meta[a];
222+ return typeof c === 'string'
223+ ? c
224+ : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
225+ }) + '"' : '"' + string + '"';
221226 }
222227
223228
@@ -300,11 +305,11 @@
300305 // Join all of the elements together, separated with commas, and wrap them in
301306 // brackets.
302307
303- v = partial.length === 0 ? '[]' :
304- gap ? '[\n' + gap +
305- partial.join(',\n' + gap) + '\n' +
306- mind + ']' :
307- '[' + partial.join(',') + ']';
308+ v = partial.length === 0
309+ ? '[]'
310+ : gap
311+ ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
312+ : '[' + partial.join(',') + ']';
308313 gap = mind;
309314 return v;
310315 }
@@ -314,8 +319,8 @@
314319 if (rep && typeof rep === 'object') {
315320 length = rep.length;
316321 for (i = 0; i < length; i += 1) {
317- k = rep[i];
318- if (typeof k === 'string') {
322+ if (typeof rep[i] === 'string') {
323+ k = rep[i];
319324 v = str(k, value);
320325 if (v) {
321326 partial.push(quote(k) + (gap ? ': ' : ':') + v);
@@ -327,7 +332,7 @@
327332 // Otherwise, iterate through all of the keys in the object.
328333
329334 for (k in value) {
330- if (Object.hasOwnProperty.call(value, k)) {
335+ if (Object.prototype.hasOwnProperty.call(value, k)) {
331336 v = str(k, value);
332337 if (v) {
333338 partial.push(quote(k) + (gap ? ': ' : ':') + v);
@@ -339,9 +344,11 @@
339344 // Join all of the member texts together, separated with commas,
340345 // and wrap them in braces.
341346
342- v = partial.length === 0 ? '{}' :
343- gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
344- mind + '}' : '{' + partial.join(',') + '}';
347+ v = partial.length === 0
348+ ? '{}'
349+ : gap
350+ ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
351+ : '{' + partial.join(',') + '}';
345352 gap = mind;
346353 return v;
347354 }
@@ -382,7 +389,7 @@
382389 rep = replacer;
383390 if (replacer && typeof replacer !== 'function' &&
384391 (typeof replacer !== 'object' ||
385- typeof replacer.length !== 'number')) {
392+ typeof replacer.length !== 'number')) {
386393 throw new Error('JSON.stringify');
387394 }
388395
@@ -412,7 +419,7 @@
412419 var k, v, value = holder[key];
413420 if (value && typeof value === 'object') {
414421 for (k in value) {
415- if (Object.hasOwnProperty.call(value, k)) {
422+ if (Object.prototype.hasOwnProperty.call(value, k)) {
416423 v = walk(value, k);
417424 if (v !== undefined) {
418425 value[k] = v;
@@ -430,6 +437,7 @@
430437 // Unicode characters with escape sequences. JavaScript handles many characters
431438 // incorrectly, either silently deleting them, or treating them as line endings.
432439
440+ text = String(text);
433441 cx.lastIndex = 0;
434442 if (cx.test(text)) {
435443 text = text.replace(cx, function (a) {
@@ -451,10 +459,10 @@
451459 // we look to see that the remaining characters are only whitespace or ']' or
452460 // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
453461
454- if (/^[\],:{}\s]*$/.
455-test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
456-replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
457-replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
462+ if (/^[\],:{}\s]*$/
463+ .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
464+ .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
465+ .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
458466
459467 // In the third stage we use the eval function to compile the text into a
460468 // JavaScript structure. The '{' operator is subject to a syntactic ambiguity
@@ -466,8 +474,9 @@
466474 // In the optional fourth stage, we recursively walk the new structure, passing
467475 // each name/value pair to a reviver function for possible transformation.
468476
469- return typeof reviver === 'function' ?
470- walk({'': j}, '') : j;
477+ return typeof reviver === 'function'
478+ ? walk({'': j}, '')
479+ : j;
471480 }
472481
473482 // If the text is not JSON parseable, then a SyntaxError is thrown.
@@ -475,4 +484,4 @@
475484 throw new SyntaxError('JSON.parse');
476485 };
477486 }
478-})();
487+}());
--- trunk/src/main1/lib/aaoh.kaze.js (revision 26)
+++ trunk/src/main1/lib/aaoh.kaze.js (revision 27)
@@ -33,7 +33,7 @@
3333 * @namespace
3434 */
3535 aaoh.kaze = {
36- VERSION: "0.9.6",
36+ VERSION: "1.0.0",
3737 FLG_WINDOW: 0, // 0: default, 1: Google, 2: Yahoo
3838
3939 /**
--- trunk/README.txt (revision 26)
+++ trunk/README.txt (revision 27)
@@ -173,6 +173,9 @@
173173 履歴
174174 ################
175175
176+2012/12/xx
177+ Version: 1.0.0
178+
176179 2011/02/27
177180 Version: 0.9.6
178181 json2.jsを最新(2011-01-18)に変更
Show on old repository browser