diff options
| author | tdro <tdro@noreply.example.com> | 2024-07-17 00:00:00 +0000 |
|---|---|---|
| committer | tdro <tdro@noreply.example.com> | 2024-07-17 00:00:00 +0000 |
| commit | ad0126e991b5e3060fbe282db624a6f33933a5dc (patch) | |
| tree | f75c7d93709e2e19617bad9681235dc645634975 | |
| parent | ecba42b73815c16fc29125ea74aaa29f8594ecf3 (diff) | |
| download | canory-ad0126e991b5e3060fbe282db624a6f33933a5dc.tar.gz canory-ad0126e991b5e3060fbe282db624a6f33933a5dc.tar.bz2 canory-ad0126e991b5e3060fbe282db624a6f33933a5dc.zip | |
static/js/infinitescroll: Avoid gathering text nodes
| -rw-r--r-- | assets/js/index.js | 4 | ||||
| -rw-r--r-- | static/js/infinitescroll.ts | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/assets/js/index.js b/assets/js/index.js index 1c7626c..6f91634 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -847,11 +847,11 @@ if (threshold && pagination.remove() === undefined) { fetch(next.href, "GET", function(http) { const page = new DOMParser().parseFromString(http.responseText, "text/html"); - const items = page.querySelector("main").childNodes; + const items = page.querySelector("main").children; const paginate = page.querySelector('[data-type="pagination"]'); + console.log("INFO: Fetch", next.href, items); for(let i1 = 0; i1 < items.length; i1++)main.appendChild(items[i1]); main.after(paginate); - console.log("INFO: Fetch", next.href, items); }, function(http) { console.warn("WARNING: Switching to native pagination", http); main.insertAdjacentElement("afterend", pagination); diff --git a/static/js/infinitescroll.ts b/static/js/infinitescroll.ts index 63077a5..15f2824 100644 --- a/static/js/infinitescroll.ts +++ b/static/js/infinitescroll.ts @@ -59,15 +59,15 @@ fetch(next.href, "GET", function (http) { const page = (new DOMParser()).parseFromString(http.responseText, "text/html"); - const items = page.querySelector("main").childNodes; + const items = page.querySelector("main").children; const paginate = page.querySelector('[data-type="pagination"]'); + console.log("INFO: Fetch", next.href, items); + for (let i = 0; i < items.length; i++) main.appendChild(items[i]); main.after(paginate); - console.log("INFO: Fetch", next.href, items); - }, function (http) { console.warn("WARNING: Switching to native pagination", http); main.insertAdjacentElement("afterend", pagination); |
