diff options
author | Oleg Gaidarenko <markelog@gmail.com> | 2014-01-27 23:43:27 +0400 |
---|---|---|
committer | Oleg Gaidarenko <markelog@gmail.com> | 2014-04-15 17:45:58 +0400 |
commit | a7c9facc357b4d2d98844cda4c26bb2e560c0cc8 (patch) | |
tree | b323d8efbafd3e15f68ce5f0aad20a2fdb312af5 /test | |
parent | 7149726485ff41afcfd2d12cb3041fe268cc909d (diff) | |
download | jquery-a7c9facc357b4d2d98844cda4c26bb2e560c0cc8.tar.gz jquery-a7c9facc357b4d2d98844cda4c26bb2e560c0cc8.zip |
Tests: Simplify globals cleanup
Diffstat (limited to 'test')
-rw-r--r-- | test/data/testrunner.js | 19 |
1 files 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 = {}; } }; })(); |