Commit a7c9facc authored by Oleg Gaidarenko's avatar Oleg Gaidarenko

Tests: Simplify globals cleanup

parent 71497264
...@@ -172,23 +172,22 @@ reset = function () { ...@@ -172,23 +172,22 @@ reset = function () {
QUnit.testDone(reset); QUnit.testDone(reset);
// Register globals for cleanup and the cleanup code itself // Register globals for cleanup and the cleanup code itself
// Explanation at http://perfectionkills.com/understanding-delete/#ie_bugs
window.Globals = (function() { window.Globals = (function() {
var globals = {}; var globals = {};
return { return {
register: function( name ) { register: function( name ) {
globals[ name ] = true; window[ name ] = globals[ name ] = true;
supportjQuery.globalEval( "var " + name + " = undefined;" );
}, },
cleanup: function() { cleanup: function() {
var name, var name;
current = globals;
globals = {}; for ( name in globals ) {
for ( name in current ) { delete window[ name ];
supportjQuery.globalEval( "try { " +
"delete " + ( supportjQuery.support.deleteExpando ? "window['" + name + "']" : name ) +
"; } catch( x ) {}" );
} }
globals = {};
} }
}; };
})(); })();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment