Skip to content

Commit 9a2c006

Browse files
committed
IntersectionObserver's threshold option should be an union
1 parent 7202d75 commit 9a2c006

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/browser/dom/intersection_observer.zig

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub const IntersectionObserver = struct {
5151
var options = IntersectionObserverOptions{
5252
.root = parser.documentToNode(parser.documentHTMLToDocument(page.window.document)),
5353
.rootMargin = "0px 0px 0px 0px",
54-
.threshold = &.{0.0},
54+
.threshold = .{ .single = 0.0 },
5555
};
5656
if (options_) |*o| {
5757
if (o.root) |root| {
@@ -107,7 +107,12 @@ pub const IntersectionObserver = struct {
107107
const IntersectionObserverOptions = struct {
108108
root: ?*parser.Node, // Element or Document
109109
rootMargin: ?[]const u8,
110-
threshold: ?[]const f32,
110+
threshold: ?Threshold,
111+
112+
const Threshold = union(enum) {
113+
single: f32,
114+
list: []const f32,
115+
};
111116
};
112117

113118
// https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserverEntry

0 commit comments

Comments
 (0)