From 09789b0b7247ce26e0dd36f886b8bc1120980071 Mon Sep 17 00:00:00 2001 From: egrs Date: Tue, 17 Feb 2026 15:38:02 +0100 Subject: [PATCH] use performance.now() for IntersectionObserverEntry.time The time field was hardcoded to 0.0. Now uses the Performance API to provide a real DOMHighResTimeStamp, matching the spec. --- src/browser/tests/intersection_observer/basic.html | 2 ++ src/browser/webapi/IntersectionObserver.zig | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/browser/tests/intersection_observer/basic.html b/src/browser/tests/intersection_observer/basic.html index dde36231..3c9258bf 100644 --- a/src/browser/tests/intersection_observer/basic.html +++ b/src/browser/tests/intersection_observer/basic.html @@ -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(); }); diff --git a/src/browser/webapi/IntersectionObserver.zig b/src/browser/webapi/IntersectionObserver.zig index 8f0b338e..a8f7ba1a 100644 --- a/src/browser/webapi/IntersectionObserver.zig +++ b/src/browser/webapi/IntersectionObserver.zig @@ -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,