From 49ce1f47c31a27142f2485a93af05bf665dde7cb Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Wed, 11 Nov 2020 11:49:15 +0100 Subject: [PATCH] Fix as in https://github.com/sitespeedio/coach-core/issues/21#issuecomment-717041439 --- lib/dom/performance/jquery.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/dom/performance/jquery.js b/lib/dom/performance/jquery.js index 261724b..a495533 100644 --- a/lib/dom/performance/jquery.js +++ b/lib/dom/performance/jquery.js @@ -1,11 +1,13 @@ (function() { 'use strict'; - var versions = []; + const versions = []; // check that we got a jQuery if (typeof window.jQuery === 'function') { + // https://github.com/sitespeedio/coach-core/issues/21#issuecomment-717041439 + let keepRef = window.$; versions.push(window.jQuery.fn.jquery); - var old = window.jQuery; + let old = window.jQuery; while (old.fn && old.fn.jquery) { old = window.jQuery.noConflict(true); if (!window.jQuery || !window.jQuery.fn) { @@ -16,6 +18,7 @@ } versions.push(window.jQuery.fn.jquery); } + window.$ = keepRef; } // TODO also add check for jQuery version. If we have a really old version (1 year old?) then show it!