function load(path) { var url = location.pathname + "#" + encodeURIComponent(path.replace(/^\.\//, '')) Test.TAP.prototype.diag('loading: '+path+' (run in a single window)...'); var req = new XMLHttpRequest(); req.open("GET", path, false); req.send(null); if (req.readyState == 4) { var testobj = eval(req.responseText); return testobj; } } function createScriptTag(library) { var path = library.replace(/\./g, '/')+'.js'; var script = document.createElement("script"); script.src = lib+'/'+path; return script; } function loadlib(library) { document.body.appendChild(createScriptTag(library)); } function loadTest(test) { var path = testlib+'/'+test; return load(path); } function loadComponents() { for (c in toLoad) { var comp = toLoad[c]; loadlib(comp); } } function runtest(t) { var outtxt = ""; var div = document.createElement("div"); var onclick = function () { var c = div.className; if (c.match(/big/)) { c = c.replace(/big/, "small"); } else if (c.match(/small/)) { c = c.replace(/small/, "big"); } div.className = c; }; div.addEventListener('click', onclick, true); div.className = 'test small'; document.body.appendChild(div); var outfunc = function(text) { if (text) { outtxt += text; if (text.match(/(not ok|Test Suite Crashed)/g) ) { div.innerHTML = "