Pellentesque nibh felis, eleifend id, commodo in, interdum vitae, leo. Praesent eu elit. Ut eu ligula. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Maecenas elementum augue nec nisl. Proin auctor lorem at nibh. Curabitur nulla purus, feugiat id, elementum in, lobortis quis, pede. Vivamus sodales adipiscing sapien. Vestibulum posuere nulla eget wisi. Integer volutpat ligula eget enim. Suspendisse vitae arcu. Quisque pellentesque. Nullam consequat, sem vitae rhoncus tristique, mauris nulla fermentum est, bibendum ullamcorper sapien magna et quam. Sed dapibus vehicula odio. Proin bibendum gravida nisl. Fusce lorem. Phasellus sagittis, nulla in hendrerit laoreet, libero lacus feugiat urna, eget hendrerit pede magna vitae lorem. Praesent mauris.
2 |
3 |
--------------------------------------------------------------------------------
/test/test.js:
--------------------------------------------------------------------------------
1 | module('open-close');
2 |
3 | asyncTest('open', 6, function () {
4 | var button = $('.open-close .actionable');
5 |
6 | ok($('#long-comment').html() === '', '#long-comment div starts empty');
7 |
8 | button.click();
9 |
10 | ok(button.find('.when-open').is(':visible'), '.when-open was shown');
11 | ok(!button.find('.when-closed').is(':visible'), '.when-closed was hidden');
12 |
13 | ok($('#long-comment img').length === 1, 'spinner image was added to #long-comment');
14 |
15 | // Wait while it loads the contents for the div.
16 | pebbles.utils.wait(100, function () {
17 | ok($('#long-comment').children('img').length === 0, 'spinner was removed when comment loaded');
18 | ok($('#long-comment').children('p').length === 3, '#long-comment div loaded html
';
650 | }
651 | if (!result) {
652 | var source = sourceFromStacktrace();
653 | if (source) {
654 | details.source = source;
655 | output += '
Source:
' + escapeInnerText(source) + '
';
656 | }
657 | }
658 | output += "
";
659 |
660 | runLoggingCallbacks( 'log', QUnit, details );
661 |
662 | config.current.assertions.push({
663 | result: !!result,
664 | message: output
665 | });
666 | },
667 |
668 | url: function( params ) {
669 | params = extend( extend( {}, QUnit.urlParams ), params );
670 | var querystring = "?",
671 | key;
672 | for ( key in params ) {
673 | querystring += encodeURIComponent( key ) + "=" +
674 | encodeURIComponent( params[ key ] ) + "&";
675 | }
676 | return window.location.pathname + querystring.slice( 0, -1 );
677 | },
678 |
679 | extend: extend,
680 | id: id,
681 | addEvent: addEvent
682 | });
683 |
684 | //QUnit.constructor is set to the empty F() above so that we can add to it's prototype later
685 | //Doing this allows us to tell if the following methods have been overwritten on the actual
686 | //QUnit object, which is a deprecated way of using the callbacks.
687 | extend(QUnit.constructor.prototype, {
688 | // Logging callbacks; all receive a single argument with the listed properties
689 | // run test/logs.html for any related changes
690 | begin: registerLoggingCallback('begin'),
691 | // done: { failed, passed, total, runtime }
692 | done: registerLoggingCallback('done'),
693 | // log: { result, actual, expected, message }
694 | log: registerLoggingCallback('log'),
695 | // testStart: { name }
696 | testStart: registerLoggingCallback('testStart'),
697 | // testDone: { name, failed, passed, total }
698 | testDone: registerLoggingCallback('testDone'),
699 | // moduleStart: { name }
700 | moduleStart: registerLoggingCallback('moduleStart'),
701 | // moduleDone: { name, failed, passed, total }
702 | moduleDone: registerLoggingCallback('moduleDone')
703 | });
704 |
705 | if ( typeof document === "undefined" || document.readyState === "complete" ) {
706 | config.autorun = true;
707 | }
708 |
709 | QUnit.load = function() {
710 | runLoggingCallbacks( 'begin', QUnit, {} );
711 |
712 | // Initialize the config, saving the execution queue
713 | var oldconfig = extend({}, config);
714 | QUnit.init();
715 | extend(config, oldconfig);
716 |
717 | config.blocking = false;
718 |
719 | var urlConfigHtml = '', len = config.urlConfig.length;
720 | for ( var i = 0, val; i < len, val = config.urlConfig[i]; i++ ) {
721 | config[val] = QUnit.urlParams[val];
722 | urlConfigHtml += '';
723 | }
724 |
725 | var userAgent = id("qunit-userAgent");
726 | if ( userAgent ) {
727 | userAgent.innerHTML = navigator.userAgent;
728 | }
729 | var banner = id("qunit-header");
730 | if ( banner ) {
731 | banner.innerHTML = ' ' + banner.innerHTML + ' ' + urlConfigHtml;
732 | addEvent( banner, "change", function( event ) {
733 | var params = {};
734 | params[ event.target.name ] = event.target.checked ? true : undefined;
735 | window.location = QUnit.url( params );
736 | });
737 | }
738 |
739 | var toolbar = id("qunit-testrunner-toolbar");
740 | if ( toolbar ) {
741 | var filter = document.createElement("input");
742 | filter.type = "checkbox";
743 | filter.id = "qunit-filter-pass";
744 | addEvent( filter, "click", function() {
745 | var ol = document.getElementById("qunit-tests");
746 | if ( filter.checked ) {
747 | ol.className = ol.className + " hidepass";
748 | } else {
749 | var tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " ";
750 | ol.className = tmp.replace(/ hidepass /, " ");
751 | }
752 | if ( defined.sessionStorage ) {
753 | if (filter.checked) {
754 | sessionStorage.setItem("qunit-filter-passed-tests", "true");
755 | } else {
756 | sessionStorage.removeItem("qunit-filter-passed-tests");
757 | }
758 | }
759 | });
760 | if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) {
761 | filter.checked = true;
762 | var ol = document.getElementById("qunit-tests");
763 | ol.className = ol.className + " hidepass";
764 | }
765 | toolbar.appendChild( filter );
766 |
767 | var label = document.createElement("label");
768 | label.setAttribute("for", "qunit-filter-pass");
769 | label.innerHTML = "Hide passed tests";
770 | toolbar.appendChild( label );
771 | }
772 |
773 | var main = id('qunit-fixture');
774 | if ( main ) {
775 | config.fixture = main.innerHTML;
776 | }
777 |
778 | if (config.autostart) {
779 | QUnit.start();
780 | }
781 | };
782 |
783 | addEvent(window, "load", QUnit.load);
784 |
785 | function done() {
786 | config.autorun = true;
787 |
788 | // Log the last module results
789 | if ( config.currentModule ) {
790 | runLoggingCallbacks( 'moduleDone', QUnit, {
791 | name: config.currentModule,
792 | failed: config.moduleStats.bad,
793 | passed: config.moduleStats.all - config.moduleStats.bad,
794 | total: config.moduleStats.all
795 | } );
796 | }
797 |
798 | var banner = id("qunit-banner"),
799 | tests = id("qunit-tests"),
800 | runtime = +new Date - config.started,
801 | passed = config.stats.all - config.stats.bad,
802 | html = [
803 | 'Tests completed in ',
804 | runtime,
805 | ' milliseconds. ',
806 | '',
807 | passed,
808 | ' tests of ',
809 | config.stats.all,
810 | ' passed, ',
811 | config.stats.bad,
812 | ' failed.'
813 | ].join('');
814 |
815 | if ( banner ) {
816 | banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass");
817 | }
818 |
819 | if ( tests ) {
820 | id( "qunit-testresult" ).innerHTML = html;
821 | }
822 |
823 | if ( config.altertitle && typeof document !== "undefined" && document.title ) {
824 | // show ✖ for good, ✔ for bad suite result in title
825 | // use escape sequences in case file gets loaded with non-utf-8-charset
826 | document.title = [
827 | (config.stats.bad ? "\u2716" : "\u2714"),
828 | document.title.replace(/^[\u2714\u2716] /i, "")
829 | ].join(" ");
830 | }
831 |
832 | runLoggingCallbacks( 'done', QUnit, {
833 | failed: config.stats.bad,
834 | passed: passed,
835 | total: config.stats.all,
836 | runtime: runtime
837 | } );
838 | }
839 |
840 | function validTest( name ) {
841 | var filter = config.filter,
842 | run = false;
843 |
844 | if ( !filter ) {
845 | return true;
846 | }
847 |
848 | var not = filter.charAt( 0 ) === "!";
849 | if ( not ) {
850 | filter = filter.slice( 1 );
851 | }
852 |
853 | if ( name.indexOf( filter ) !== -1 ) {
854 | return !not;
855 | }
856 |
857 | if ( not ) {
858 | run = true;
859 | }
860 |
861 | return run;
862 | }
863 |
864 | // so far supports only Firefox, Chrome and Opera (buggy)
865 | // could be extended in the future to use something like https://github.com/csnover/TraceKit
866 | function sourceFromStacktrace() {
867 | try {
868 | throw new Error();
869 | } catch ( e ) {
870 | if (e.stacktrace) {
871 | // Opera
872 | return e.stacktrace.split("\n")[6];
873 | } else if (e.stack) {
874 | // Firefox, Chrome
875 | return e.stack.split("\n")[4];
876 | } else if (e.sourceURL) {
877 | // Safari, PhantomJS
878 | // TODO sourceURL points at the 'throw new Error' line above, useless
879 | //return e.sourceURL + ":" + e.line;
880 | }
881 | }
882 | }
883 |
884 | function escapeInnerText(s) {
885 | if (!s) {
886 | return "";
887 | }
888 | s = s + "";
889 | return s.replace(/[\&<>]/g, function(s) {
890 | switch(s) {
891 | case "&": return "&";
892 | case "<": return "<";
893 | case ">": return ">";
894 | default: return s;
895 | }
896 | });
897 | }
898 |
899 | function synchronize( callback ) {
900 | config.queue.push( callback );
901 |
902 | if ( config.autorun && !config.blocking ) {
903 | process();
904 | }
905 | }
906 |
907 | function process() {
908 | var start = (new Date()).getTime();
909 |
910 | while ( config.queue.length && !config.blocking ) {
911 | if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) {
912 | config.queue.shift()();
913 | } else {
914 | window.setTimeout( process, 13 );
915 | break;
916 | }
917 | }
918 | if (!config.blocking && !config.queue.length) {
919 | done();
920 | }
921 | }
922 |
923 | function saveGlobal() {
924 | config.pollution = [];
925 |
926 | if ( config.noglobals ) {
927 | for ( var key in window ) {
928 | config.pollution.push( key );
929 | }
930 | }
931 | }
932 |
933 | function checkPollution( name ) {
934 | var old = config.pollution;
935 | saveGlobal();
936 |
937 | var newGlobals = diff( config.pollution, old );
938 | if ( newGlobals.length > 0 ) {
939 | ok( false, "Introduced global variable(s): " + newGlobals.join(", ") );
940 | }
941 |
942 | var deletedGlobals = diff( old, config.pollution );
943 | if ( deletedGlobals.length > 0 ) {
944 | ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") );
945 | }
946 | }
947 |
948 | // returns a new Array with the elements that are in a but not in b
949 | function diff( a, b ) {
950 | var result = a.slice();
951 | for ( var i = 0; i < result.length; i++ ) {
952 | for ( var j = 0; j < b.length; j++ ) {
953 | if ( result[i] === b[j] ) {
954 | result.splice(i, 1);
955 | i--;
956 | break;
957 | }
958 | }
959 | }
960 | return result;
961 | }
962 |
963 | function fail(message, exception, callback) {
964 | if ( typeof console !== "undefined" && console.error && console.warn ) {
965 | console.error(message);
966 | console.error(exception);
967 | console.warn(callback.toString());
968 |
969 | } else if ( window.opera && opera.postError ) {
970 | opera.postError(message, exception, callback.toString);
971 | }
972 | }
973 |
974 | function extend(a, b) {
975 | for ( var prop in b ) {
976 | if ( b[prop] === undefined ) {
977 | delete a[prop];
978 | } else {
979 | a[prop] = b[prop];
980 | }
981 | }
982 |
983 | return a;
984 | }
985 |
986 | function addEvent(elem, type, fn) {
987 | if ( elem.addEventListener ) {
988 | elem.addEventListener( type, fn, false );
989 | } else if ( elem.attachEvent ) {
990 | elem.attachEvent( "on" + type, fn );
991 | } else {
992 | fn();
993 | }
994 | }
995 |
996 | function id(name) {
997 | return !!(typeof document !== "undefined" && document && document.getElementById) &&
998 | document.getElementById( name );
999 | }
1000 |
1001 | function registerLoggingCallback(key){
1002 | return function(callback){
1003 | config[key].push( callback );
1004 | };
1005 | }
1006 |
1007 | // Supports deprecated method of completely overwriting logging callbacks
1008 | function runLoggingCallbacks(key, scope, args) {
1009 | //debugger;
1010 | var callbacks;
1011 | if ( QUnit.hasOwnProperty(key) ) {
1012 | QUnit[key].call(scope, args);
1013 | } else {
1014 | callbacks = config[key];
1015 | for( var i = 0; i < callbacks.length; i++ ) {
1016 | callbacks[i].call( scope, args );
1017 | }
1018 | }
1019 | }
1020 |
1021 | // Test for equality any JavaScript type.
1022 | // Author: Philippe Rathé
1023 | QUnit.equiv = function () {
1024 |
1025 | var innerEquiv; // the real equiv function
1026 | var callers = []; // stack to decide between skip/abort functions
1027 | var parents = []; // stack to avoiding loops from circular referencing
1028 |
1029 | // Call the o related callback with the given arguments.
1030 | function bindCallbacks(o, callbacks, args) {
1031 | var prop = QUnit.objectType(o);
1032 | if (prop) {
1033 | if (QUnit.objectType(callbacks[prop]) === "function") {
1034 | return callbacks[prop].apply(callbacks, args);
1035 | } else {
1036 | return callbacks[prop]; // or undefined
1037 | }
1038 | }
1039 | }
1040 |
1041 | var callbacks = function () {
1042 |
1043 | // for string, boolean, number and null
1044 | function useStrictEquality(b, a) {
1045 | if (b instanceof a.constructor || a instanceof b.constructor) {
1046 | // to catch short annotaion VS 'new' annotation of a
1047 | // declaration
1048 | // e.g. var i = 1;
1049 | // var j = new Number(1);
1050 | return a == b;
1051 | } else {
1052 | return a === b;
1053 | }
1054 | }
1055 |
1056 | return {
1057 | "string" : useStrictEquality,
1058 | "boolean" : useStrictEquality,
1059 | "number" : useStrictEquality,
1060 | "null" : useStrictEquality,
1061 | "undefined" : useStrictEquality,
1062 |
1063 | "nan" : function(b) {
1064 | return isNaN(b);
1065 | },
1066 |
1067 | "date" : function(b, a) {
1068 | return QUnit.objectType(b) === "date"
1069 | && a.valueOf() === b.valueOf();
1070 | },
1071 |
1072 | "regexp" : function(b, a) {
1073 | return QUnit.objectType(b) === "regexp"
1074 | && a.source === b.source && // the regex itself
1075 | a.global === b.global && // and its modifers
1076 | // (gmi) ...
1077 | a.ignoreCase === b.ignoreCase
1078 | && a.multiline === b.multiline;
1079 | },
1080 |
1081 | // - skip when the property is a method of an instance (OOP)
1082 | // - abort otherwise,
1083 | // initial === would have catch identical references anyway
1084 | "function" : function() {
1085 | var caller = callers[callers.length - 1];
1086 | return caller !== Object && typeof caller !== "undefined";
1087 | },
1088 |
1089 | "array" : function(b, a) {
1090 | var i, j, loop;
1091 | var len;
1092 |
1093 | // b could be an object literal here
1094 | if (!(QUnit.objectType(b) === "array")) {
1095 | return false;
1096 | }
1097 |
1098 | len = a.length;
1099 | if (len !== b.length) { // safe and faster
1100 | return false;
1101 | }
1102 |
1103 | // track reference to avoid circular references
1104 | parents.push(a);
1105 | for (i = 0; i < len; i++) {
1106 | loop = false;
1107 | for (j = 0; j < parents.length; j++) {
1108 | if (parents[j] === a[i]) {
1109 | loop = true;// dont rewalk array
1110 | }
1111 | }
1112 | if (!loop && !innerEquiv(a[i], b[i])) {
1113 | parents.pop();
1114 | return false;
1115 | }
1116 | }
1117 | parents.pop();
1118 | return true;
1119 | },
1120 |
1121 | "object" : function(b, a) {
1122 | var i, j, loop;
1123 | var eq = true; // unless we can proove it
1124 | var aProperties = [], bProperties = []; // collection of
1125 | // strings
1126 |
1127 | // comparing constructors is more strict than using
1128 | // instanceof
1129 | if (a.constructor !== b.constructor) {
1130 | return false;
1131 | }
1132 |
1133 | // stack constructor before traversing properties
1134 | callers.push(a.constructor);
1135 | // track reference to avoid circular references
1136 | parents.push(a);
1137 |
1138 | for (i in a) { // be strict: don't ensures hasOwnProperty
1139 | // and go deep
1140 | loop = false;
1141 | for (j = 0; j < parents.length; j++) {
1142 | if (parents[j] === a[i])
1143 | loop = true; // don't go down the same path
1144 | // twice
1145 | }
1146 | aProperties.push(i); // collect a's properties
1147 |
1148 | if (!loop && !innerEquiv(a[i], b[i])) {
1149 | eq = false;
1150 | break;
1151 | }
1152 | }
1153 |
1154 | callers.pop(); // unstack, we are done
1155 | parents.pop();
1156 |
1157 | for (i in b) {
1158 | bProperties.push(i); // collect b's properties
1159 | }
1160 |
1161 | // Ensures identical properties name
1162 | return eq
1163 | && innerEquiv(aProperties.sort(), bProperties
1164 | .sort());
1165 | }
1166 | };
1167 | }();
1168 |
1169 | innerEquiv = function() { // can take multiple arguments
1170 | var args = Array.prototype.slice.apply(arguments);
1171 | if (args.length < 2) {
1172 | return true; // end transition
1173 | }
1174 |
1175 | return (function(a, b) {
1176 | if (a === b) {
1177 | return true; // catch the most you can
1178 | } else if (a === null || b === null || typeof a === "undefined"
1179 | || typeof b === "undefined"
1180 | || QUnit.objectType(a) !== QUnit.objectType(b)) {
1181 | return false; // don't lose time with error prone cases
1182 | } else {
1183 | return bindCallbacks(a, callbacks, [ b, a ]);
1184 | }
1185 |
1186 | // apply transition with (1..n) arguments
1187 | })(args[0], args[1])
1188 | && arguments.callee.apply(this, args.splice(1,
1189 | args.length - 1));
1190 | };
1191 |
1192 | return innerEquiv;
1193 |
1194 | }();
1195 |
1196 | /**
1197 | * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com |
1198 | * http://flesler.blogspot.com Licensed under BSD
1199 | * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008
1200 | *
1201 | * @projectDescription Advanced and extensible data dumping for Javascript.
1202 | * @version 1.0.0
1203 | * @author Ariel Flesler
1204 | * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
1205 | */
1206 | QUnit.jsDump = (function() {
1207 | function quote( str ) {
1208 | return '"' + str.toString().replace(/"/g, '\\"') + '"';
1209 | };
1210 | function literal( o ) {
1211 | return o + '';
1212 | };
1213 | function join( pre, arr, post ) {
1214 | var s = jsDump.separator(),
1215 | base = jsDump.indent(),
1216 | inner = jsDump.indent(1);
1217 | if ( arr.join )
1218 | arr = arr.join( ',' + s + inner );
1219 | if ( !arr )
1220 | return pre + post;
1221 | return [ pre, inner + arr, base + post ].join(s);
1222 | };
1223 | function array( arr, stack ) {
1224 | var i = arr.length, ret = Array(i);
1225 | this.up();
1226 | while ( i-- )
1227 | ret[i] = this.parse( arr[i] , undefined , stack);
1228 | this.down();
1229 | return join( '[', ret, ']' );
1230 | };
1231 |
1232 | var reName = /^function (\w+)/;
1233 |
1234 | var jsDump = {
1235 | parse:function( obj, type, stack ) { //type is used mostly internally, you can fix a (custom)type in advance
1236 | stack = stack || [ ];
1237 | var parser = this.parsers[ type || this.typeOf(obj) ];
1238 | type = typeof parser;
1239 | var inStack = inArray(obj, stack);
1240 | if (inStack != -1) {
1241 | return 'recursion('+(inStack - stack.length)+')';
1242 | }
1243 | //else
1244 | if (type == 'function') {
1245 | stack.push(obj);
1246 | var res = parser.call( this, obj, stack );
1247 | stack.pop();
1248 | return res;
1249 | }
1250 | // else
1251 | return (type == 'string') ? parser : this.parsers.error;
1252 | },
1253 | typeOf:function( obj ) {
1254 | var type;
1255 | if ( obj === null ) {
1256 | type = "null";
1257 | } else if (typeof obj === "undefined") {
1258 | type = "undefined";
1259 | } else if (QUnit.is("RegExp", obj)) {
1260 | type = "regexp";
1261 | } else if (QUnit.is("Date", obj)) {
1262 | type = "date";
1263 | } else if (QUnit.is("Function", obj)) {
1264 | type = "function";
1265 | } else if (typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined") {
1266 | type = "window";
1267 | } else if (obj.nodeType === 9) {
1268 | type = "document";
1269 | } else if (obj.nodeType) {
1270 | type = "node";
1271 | } else if (typeof obj === "object" && typeof obj.length === "number" && obj.length >= 0) {
1272 | type = "array";
1273 | } else {
1274 | type = typeof obj;
1275 | }
1276 | return type;
1277 | },
1278 | separator:function() {
1279 | return this.multiline ? this.HTML ? ' ' : '\n' : this.HTML ? ' ' : ' ';
1280 | },
1281 | indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing
1282 | if ( !this.multiline )
1283 | return '';
1284 | var chr = this.indentChar;
1285 | if ( this.HTML )
1286 | chr = chr.replace(/\t/g,' ').replace(/ /g,' ');
1287 | return Array( this._depth_ + (extra||0) ).join(chr);
1288 | },
1289 | up:function( a ) {
1290 | this._depth_ += a || 1;
1291 | },
1292 | down:function( a ) {
1293 | this._depth_ -= a || 1;
1294 | },
1295 | setParser:function( name, parser ) {
1296 | this.parsers[name] = parser;
1297 | },
1298 | // The next 3 are exposed so you can use them
1299 | quote:quote,
1300 | literal:literal,
1301 | join:join,
1302 | //
1303 | _depth_: 1,
1304 | // This is the list of parsers, to modify them, use jsDump.setParser
1305 | parsers:{
1306 | window: '[Window]',
1307 | document: '[Document]',
1308 | error:'[ERROR]', //when no parser is found, shouldn't happen
1309 | unknown: '[Unknown]',
1310 | 'null':'null',
1311 | 'undefined':'undefined',
1312 | 'function':function( fn ) {
1313 | var ret = 'function',
1314 | name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE
1315 | if ( name )
1316 | ret += ' ' + name;
1317 | ret += '(';
1318 |
1319 | ret = [ ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join('');
1320 | return join( ret, QUnit.jsDump.parse(fn,'functionCode'), '}' );
1321 | },
1322 | array: array,
1323 | nodelist: array,
1324 | arguments: array,
1325 | object:function( map, stack ) {
1326 | var ret = [ ];
1327 | QUnit.jsDump.up();
1328 | for ( var key in map ) {
1329 | var val = map[key];
1330 | ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(val, undefined, stack));
1331 | }
1332 | QUnit.jsDump.down();
1333 | return join( '{', ret, '}' );
1334 | },
1335 | node:function( node ) {
1336 | var open = QUnit.jsDump.HTML ? '<' : '<',
1337 | close = QUnit.jsDump.HTML ? '>' : '>';
1338 |
1339 | var tag = node.nodeName.toLowerCase(),
1340 | ret = open + tag;
1341 |
1342 | for ( var a in QUnit.jsDump.DOMAttrs ) {
1343 | var val = node[QUnit.jsDump.DOMAttrs[a]];
1344 | if ( val )
1345 | ret += ' ' + a + '=' + QUnit.jsDump.parse( val, 'attribute' );
1346 | }
1347 | return ret + close + open + '/' + tag + close;
1348 | },
1349 | functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function
1350 | var l = fn.length;
1351 | if ( !l ) return '';
1352 |
1353 | var args = Array(l);
1354 | while ( l-- )
1355 | args[l] = String.fromCharCode(97+l);//97 is 'a'
1356 | return ' ' + args.join(', ') + ' ';
1357 | },
1358 | key:quote, //object calls it internally, the key part of an item in a map
1359 | functionCode:'[code]', //function calls it internally, it's the content of the function
1360 | attribute:quote, //node calls it internally, it's an html attribute value
1361 | string:quote,
1362 | date:quote,
1363 | regexp:literal, //regex
1364 | number:literal,
1365 | 'boolean':literal
1366 | },
1367 | DOMAttrs:{//attributes to dump from nodes, name=>realName
1368 | id:'id',
1369 | name:'name',
1370 | 'class':'className'
1371 | },
1372 | HTML:false,//if true, entities are escaped ( <, >, \t, space and \n )
1373 | indentChar:' ',//indentation unit
1374 | multiline:true //if true, items in a collection, are separated by a \n, else just a space.
1375 | };
1376 |
1377 | return jsDump;
1378 | })();
1379 |
1380 | // from Sizzle.js
1381 | function getText( elems ) {
1382 | var ret = "", elem;
1383 |
1384 | for ( var i = 0; elems[i]; i++ ) {
1385 | elem = elems[i];
1386 |
1387 | // Get the text from text nodes and CDATA nodes
1388 | if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
1389 | ret += elem.nodeValue;
1390 |
1391 | // Traverse everything else, except comment nodes
1392 | } else if ( elem.nodeType !== 8 ) {
1393 | ret += getText( elem.childNodes );
1394 | }
1395 | }
1396 |
1397 | return ret;
1398 | };
1399 |
1400 | //from jquery.js
1401 | function inArray( elem, array ) {
1402 | if ( array.indexOf ) {
1403 | return array.indexOf( elem );
1404 | }
1405 |
1406 | for ( var i = 0, length = array.length; i < length; i++ ) {
1407 | if ( array[ i ] === elem ) {
1408 | return i;
1409 | }
1410 | }
1411 |
1412 | return -1;
1413 | }
1414 |
1415 | /*
1416 | * Javascript Diff Algorithm
1417 | * By John Resig (http://ejohn.org/)
1418 | * Modified by Chu Alan "sprite"
1419 | *
1420 | * Released under the MIT license.
1421 | *
1422 | * More Info:
1423 | * http://ejohn.org/projects/javascript-diff-algorithm/
1424 | *
1425 | * Usage: QUnit.diff(expected, actual)
1426 | *
1427 | * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the quick brown fox jumped jumps over"
1428 | */
1429 | QUnit.diff = (function() {
1430 | function diff(o, n) {
1431 | var ns = {};
1432 | var os = {};
1433 |
1434 | for (var i = 0; i < n.length; i++) {
1435 | if (ns[n[i]] == null)
1436 | ns[n[i]] = {
1437 | rows: [],
1438 | o: null
1439 | };
1440 | ns[n[i]].rows.push(i);
1441 | }
1442 |
1443 | for (var i = 0; i < o.length; i++) {
1444 | if (os[o[i]] == null)
1445 | os[o[i]] = {
1446 | rows: [],
1447 | n: null
1448 | };
1449 | os[o[i]].rows.push(i);
1450 | }
1451 |
1452 | for (var i in ns) {
1453 | if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) {
1454 | n[ns[i].rows[0]] = {
1455 | text: n[ns[i].rows[0]],
1456 | row: os[i].rows[0]
1457 | };
1458 | o[os[i].rows[0]] = {
1459 | text: o[os[i].rows[0]],
1460 | row: ns[i].rows[0]
1461 | };
1462 | }
1463 | }
1464 |
1465 | for (var i = 0; i < n.length - 1; i++) {
1466 | if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null &&
1467 | n[i + 1] == o[n[i].row + 1]) {
1468 | n[i + 1] = {
1469 | text: n[i + 1],
1470 | row: n[i].row + 1
1471 | };
1472 | o[n[i].row + 1] = {
1473 | text: o[n[i].row + 1],
1474 | row: i + 1
1475 | };
1476 | }
1477 | }
1478 |
1479 | for (var i = n.length - 1; i > 0; i--) {
1480 | if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null &&
1481 | n[i - 1] == o[n[i].row - 1]) {
1482 | n[i - 1] = {
1483 | text: n[i - 1],
1484 | row: n[i].row - 1
1485 | };
1486 | o[n[i].row - 1] = {
1487 | text: o[n[i].row - 1],
1488 | row: i - 1
1489 | };
1490 | }
1491 | }
1492 |
1493 | return {
1494 | o: o,
1495 | n: n
1496 | };
1497 | }
1498 |
1499 | return function(o, n) {
1500 | o = o.replace(/\s+$/, '');
1501 | n = n.replace(/\s+$/, '');
1502 | var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/));
1503 |
1504 | var str = "";
1505 |
1506 | var oSpace = o.match(/\s+/g);
1507 | if (oSpace == null) {
1508 | oSpace = [" "];
1509 | }
1510 | else {
1511 | oSpace.push(" ");
1512 | }
1513 | var nSpace = n.match(/\s+/g);
1514 | if (nSpace == null) {
1515 | nSpace = [" "];
1516 | }
1517 | else {
1518 | nSpace.push(" ");
1519 | }
1520 |
1521 | if (out.n.length == 0) {
1522 | for (var i = 0; i < out.o.length; i++) {
1523 | str += '' + out.o[i] + oSpace[i] + "";
1524 | }
1525 | }
1526 | else {
1527 | if (out.n[0].text == null) {
1528 | for (n = 0; n < out.o.length && out.o[n].text == null; n++) {
1529 | str += '' + out.o[n] + oSpace[n] + "";
1530 | }
1531 | }
1532 |
1533 | for (var i = 0; i < out.n.length; i++) {
1534 | if (out.n[i].text == null) {
1535 | str += '' + out.n[i] + nSpace[i] + "";
1536 | }
1537 | else {
1538 | var pre = "";
1539 |
1540 | for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++) {
1541 | pre += '' + out.o[n] + oSpace[n] + "";
1542 | }
1543 | str += " " + out.n[i].text + nSpace[i] + pre;
1544 | }
1545 | }
1546 | }
1547 |
1548 | return str;
1549 | };
1550 | })();
1551 |
1552 | })(this);
1553 |
--------------------------------------------------------------------------------
/test/jquery-1.6.4.min.js:
--------------------------------------------------------------------------------
1 | /*! jQuery v1.6.4 http://jquery.com/ | http://jquery.org/license */
2 | (function(a,b){function cu(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cr(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"":"")+""),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cq(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cp(){cn=b}function co(){setTimeout(cp,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bv(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bd,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i=0===c})}function U(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function M(a,b){return(a&&a!=="*"?a+".":"")+b.replace(y,"`").replace(z,"&")}function L(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function J(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;B.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-1000px",top:"-1000px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="