From 0d72e4ca38fe28934ad396b0308f7677fa9d94fa Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Fri, 16 May 2014 18:21:59 +0300 Subject: [PATCH] Add comments about other people's bad code. --- static/cosmopolite.js | 4 ++++ static/test.js | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/static/cosmopolite.js b/static/cosmopolite.js index c4ae9c3..4d94727 100644 --- a/static/cosmopolite.js +++ b/static/cosmopolite.js @@ -171,6 +171,10 @@ Cosmopolite.prototype.onLoad_ = function() { if (--this.numScriptsToLoad_ > 0) { return; } + // jQuery.noConflict() doesn't actually remove window.$ and window.jQuery, + // it just sets them back to undefined. This angers QUnit's globals + // detection. goog.appengine.Channel doesn't even provide a noConflict() + // equivalent. this.$ = jQuery.noConflict(true); if (this.shutdown_) { // Shutdown during startup diff --git a/static/test.js b/static/test.js index ba2bf16..68433db 100644 --- a/static/test.js +++ b/static/test.js @@ -25,6 +25,17 @@ server interactions are complex and tests should be structured to verify them, not to verify the behavior of a simulation. */ +/* +These tests break if you turn on global pollution detection because of at +least: + +* $, jQuery: jQuery's noConflict() doesn't actually delete $ or jQuery; it + sets them to undefined. +* goog: goog.appengine.Channel doesn't provide any kind of noConflict() + equivalent. +* closure_lm_*: The Channel code has a bug that puts this in globals. +*/ + var randstring = function() { var ret = []; for (var i = 0; i < 16; i++) {