remove queryselectorall, always use the fallback implementation
This commit is contained in:
parent
42a8298362
commit
59c118dc34
@ -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) {
|
||||
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.length) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (s[0] === '#') {
|
||||
return document.getElementById(s.slice(1));
|
||||
return document.getElementById(s.slice(1)); // single element
|
||||
} else if (s[0] === '.') {
|
||||
return document.getElementsByClassName(s.slice(1));
|
||||
return document.getElementsByClassName(s.slice(1)); // multiple elements
|
||||
} else {
|
||||
return document.getElementsByTagName(s);
|
||||
return document.getElementsByTagName(s); // multiple elements
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
var nmdc_escape = function(str) {
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user