This commit is contained in:
Sj-Si 2024-04-15 09:31:30 -04:00
parent b7a6df9460
commit 451190c7fc
3 changed files with 11 additions and 2 deletions

View File

@ -292,7 +292,8 @@ class Clusterize {
// Get the first element that isn't one of our placeholder rows.
const node = this.content_elem.querySelector(":scope > :not(.clusterize-extra-row,.clusterize-no-data)");
if (!isElementLogError(node)) {
if (!isElement(node)) {
// dont attempt to compute dims if we have no data.
return;
}

View File

@ -15,6 +15,9 @@
*/
/*eslint no-undef: "error"*/
// number of list html items to store in cache.
const EXTRA_NETWORKS_CLUSTERIZE_LRU_CACHE_SIZE = 1000;
class NotImplementedError extends Error {
constructor(...params) {
super(...params);
@ -72,7 +75,7 @@ class ExtraNetworksClusterize extends Clusterize {
if (this.lru instanceof LRUCache) {
this.lru.clear();
} else {
this.lru = new LRUCache();
this.lru = new LRUCache(EXTRA_NETWORKS_CLUSTERIZE_LRU_CACHE_SIZE);
}
await this.reinitData();

View File

@ -411,6 +411,11 @@ function htmlStringToElement(s) {
return tmp.body.firstElementChild;
}
function htmlStringToFragment(s) {
/** Converts an HTML string into a DocumentFragment. */
return document.createRange().createContextualFragment(s);
}
function toggleCss(key, css, enable) {
var style = document.getElementById(key);
if (enable && !style) {