Internet Explorer Compatibility Fixes, tests now execute under IE instead of blanking out

git-svn-id: https://test-tap.googlecode.com/svn/trunk@6 62346678-a08d-11dd-9c66-c9f8973bfffa
This commit is contained in:
mike-google@napkindrawing.com 2008-11-02 17:08:42 +00:00
parent 230f710f01
commit a819d9e3f2
2 changed files with 21 additions and 3 deletions

View File

@ -93,7 +93,12 @@ Test.TAP.Class.prototype.run_it = function(method) {
// THis avoid conflicts between tests when running multiple tests in a row // THis avoid conflicts between tests when running multiple tests in a row
for(var name in top) { for(var name in top) {
if(!originalGlobal[name]) { if(!originalGlobal[name]) {
delete top[name] try {
delete top[name]
} catch (e) {
// Delete threw an error, so just assign undefined
top[name] = undefined
}
} }
} }
} }

View File

@ -37,7 +37,13 @@ Test.TAPBrowser.prototype = {
var url = location.pathname + "#test=" + encodeURIComponent(path.replace(/^\.\//, '')) var url = location.pathname + "#test=" + encodeURIComponent(path.replace(/^\.\//, ''))
Test.TAP.prototype.diag('loading: '+path+' <a href="'+url+'">(run in a single window)</a>...'); Test.TAP.prototype.diag('loading: '+path+' <a href="'+url+'">(run in a single window)</a>...');
var req = new XMLHttpRequest(); var req;
if(navigator.appName == 'Microsoft Internet Explorer') {
req = new ActiveXObject("Microsoft.XMLHTTP");
} else {
req = new XMLHttpRequest();
}
if(!req) throw "Can't create XML HTTP Request Object"
req.open("GET", path, false); req.open("GET", path, false);
req.send(null); req.send(null);
@ -76,7 +82,14 @@ Test.TAPBrowser.prototype = {
} }
div.className = c; div.className = c;
}; };
div.addEventListener('click', onclick, true);
if(div.addEventListener) {
div.addEventListener('click', onclick, true);
} else if(div.attachEvent) {
div.attachEvent('onclick', onclick);
} else {
throw "Can't attach event without addEventListener or attachEvent";
}
div.className = 'test small'; div.className = 'test small';
document.body.appendChild(div); document.body.appendChild(div);