From a7c9facc357b4d2d98844cda4c26bb2e560c0cc8 Mon Sep 17 00:00:00 2001 From: Oleg Gaidarenko Date: Mon, 27 Jan 2014 23:43:27 +0400 Subject: [PATCH] Tests: Simplify globals cleanup --- test/data/testrunner.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/test/data/testrunner.js b/test/data/testrunner.js index c493618e7..95df0c266 100644 --- a/test/data/testrunner.js +++ b/test/data/testrunner.js @@ -172,23 +172,22 @@ reset = function () { QUnit.testDone(reset); // Register globals for cleanup and the cleanup code itself -// Explanation at http://perfectionkills.com/understanding-delete/#ie_bugs window.Globals = (function() { var globals = {}; + return { register: function( name ) { - globals[ name ] = true; - supportjQuery.globalEval( "var " + name + " = undefined;" ); + window[ name ] = globals[ name ] = true; }, + cleanup: function() { - var name, - current = globals; - globals = {}; - for ( name in current ) { - supportjQuery.globalEval( "try { " + - "delete " + ( supportjQuery.support.deleteExpando ? "window['" + name + "']" : name ) + - "; } catch( x ) {}" ); + var name; + + for ( name in globals ) { + delete window[ name ]; } + + globals = {}; } }; })(); -- 2.39.5