diff --git a/client/dcwebui.js b/client/dcwebui.js index b85b116..6b27a30 100644 --- a/client/dcwebui.js +++ b/client/dcwebui.js @@ -7,23 +7,22 @@ var SENTINEL_PASSWORD = "************"; var CHAT_SCROLLBACK_LIMIT = 50; // Once over 2x $limit, the first $limit will be trimmed off the list var EXTERN_ROOT = window.location.protocol + "//" + window.location.host + "/"; -var $ = (document.querySelectorAll ? - function(s) { - var r = document.querySelectorAll(s); - return (s[0] === '#' && r.length === 1) ? r[0] : r; - } : - function(s) { - // i'm not writing a selector engine... - if (! s.length) return []; - if (s[0] === '#') { - return document.getElementById(s.slice(1)); - } else if (s[0] === '.') { - return document.getElementsByClassName(s.slice(1)); - } else { - return document.getElementsByTagName(s); - } +var $ = function(s) { + // There used to be a querySelectorAll implementation, but, better that we don't have + // potentially-incompatible implementations if this one does actually work. + // i'm not writing a selector engine... + if (! s.length) { + return []; } -); + + if (s[0] === '#') { + return document.getElementById(s.slice(1)); // single element + } else if (s[0] === '.') { + return document.getElementsByClassName(s.slice(1)); // multiple elements + } else { + return document.getElementsByTagName(s); // multiple elements + } +}; var nmdc_escape = function(str) { return (