From 9bb36e68870a6187b0cb3f0d78dff4ca80aa8157 Mon Sep 17 00:00:00 2001 From: khawkins98 <khawkins98@gmail.com> Date: Thu, 22 Feb 2018 10:21:32 +0000 Subject: [PATCH] Add initial detection of invoking on empty pages #115 --- js/foundationExtendEBI.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/foundationExtendEBI.js b/js/foundationExtendEBI.js index b5f1039b..24bb2864 100644 --- a/js/foundationExtendEBI.js +++ b/js/foundationExtendEBI.js @@ -428,6 +428,11 @@ function invokeResponsiveMenuEBI() { }); $.fn.foundationExtendEBI = function() { + // Warn if inoking this on a near-empty html page + if (document.querySelectorAll('body *').length < 5) { + console.warn('It looks like you\'ve called foundationExtendEBI() before your body element has been populated with content. Most likely this is as you are using a JS framework, so you might want to read the guidance at https://wwwdev.ebi.ac.uk/style-lab/websites/meta-patterns/js-frameworks.html'); + } + // Activate EMBL dropdown menu activateEMBLdropdown(); -- GitLab