becomes visible. Uses the larger
+//
becomes visible. Uses the larger
// infiniteScrollDataset (100 items) so the auto-pagination cascade is
// actually visible during the demo; ClickToLoad uses the 25-item
// listDataset which only needs a couple of clicks.
diff --git a/patterns/patterns_test.go b/patterns/patterns_test.go
index 1e181b9..44c158e 100644
--- a/patterns/patterns_test.go
+++ b/patterns/patterns_test.go
@@ -1345,7 +1345,7 @@ func TestURLFilters(t *testing.T) {
// --- Pattern #10: Infinite Scroll ---
-// TestInfiniteScroll verifies the #scroll-sentinel IntersectionObserver
+// TestInfiniteScroll verifies the [lvt-scroll-sentinel] IntersectionObserver
// wiring and the loadMorePending throttle. In headless Chrome the short
// first page keeps the sentinel intersecting, so page 2 auto-advances;
// subsequent pages require an explicit scroll because the sentinel has
@@ -1416,7 +1416,7 @@ func TestInfiniteScroll(t *testing.T) {
// Scroll once
err := chromedp.Run(ctx,
chromedp.Evaluate(`(() => {
- const s = document.getElementById('scroll-sentinel');
+ const s = document.querySelector('[lvt-scroll-sentinel]');
if (s) s.scrollIntoView({ block: 'center' });
})()`, nil),
e2etest.WaitFor(`document.querySelectorAll('tbody tr[data-key]').length > `+fmt.Sprintf("%d", baseline), 5*time.Second),
@@ -1429,7 +1429,7 @@ func TestInfiniteScroll(t *testing.T) {
_ = chromedp.Run(ctx, chromedp.Evaluate(`document.querySelectorAll('tbody tr[data-key]').length`, &afterFirstScroll))
err = chromedp.Run(ctx,
chromedp.Evaluate(`(() => {
- const s = document.getElementById('scroll-sentinel');
+ const s = document.querySelector('[lvt-scroll-sentinel]');
if (s) s.scrollIntoView({ block: 'center' });
})()`, nil),
e2etest.WaitFor(`document.querySelectorAll('tbody tr[data-key]').length > `+fmt.Sprintf("%d", afterFirstScroll), 5*time.Second),
diff --git a/patterns/templates/lists/infinite-scroll.tmpl b/patterns/templates/lists/infinite-scroll.tmpl
index 3979de1..1fc630c 100644
--- a/patterns/templates/lists/infinite-scroll.tmpl
+++ b/patterns/templates/lists/infinite-scroll.tmpl
@@ -1,7 +1,7 @@
{{define "content"}}
Infinite Scroll
- A single <div id="scroll-sentinel"> at the end of the list is watched by the client's IntersectionObserver. When it enters the viewport, the client dispatches load_more automatically — no client JS to wire up. Dataset has 100 items; scroll to watch pages append.
+ A single <div lvt-scroll-sentinel> at the end of the list is watched by the client's IntersectionObserver. When it enters the viewport, the client dispatches load_more automatically — no client JS to wire up. Dataset has 100 items; scroll to watch pages append.
| ID | Name | Email |
@@ -15,7 +15,7 @@
{{if .HasMore}}
- Loading more…
+ Loading more…
{{else}}
End of list.
{{end}}