Merge pull request #1572 from egrs/intersection-observer-timestamp

Use performance.now() for IntersectionObserverEntry.time
This commit is contained in:
Karl Seguin
2026-02-18 07:21:57 +08:00
committed by GitHub
2 changed files with 3 additions and 1 deletions

View File

@@ -25,6 +25,8 @@
testing.expectEqual('number', typeof entry.intersectionRatio);
testing.expectEqual('object', typeof entry.boundingClientRect);
testing.expectEqual('object', typeof entry.intersectionRect);
testing.expectEqual('number', typeof entry.time);
testing.expectEqual(true, entry.time > 0);
observer.disconnect();
});

View File

@@ -246,7 +246,7 @@ fn checkIntersection(self: *IntersectionObserver, target: *Element, page: *Page)
._page = page,
._arena = arena,
._target = target,
._time = 0.0, // TODO: Get actual timestamp
._time = page.window._performance.now(),
._bounding_client_rect = data.bounding_client_rect,
._intersection_rect = data.intersection_rect,
._root_bounds = data.root_bounds,