Skip to content

Commit f0017c3

Browse files
committed
No-op eventHandler's passive option
This is a hint to the brower that the listener won't call preventDefault. In theory, we should enforce this. But in practice, ignoring it should be ok.
1 parent 99b7508 commit f0017c3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/browser/dom/event_target.zig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,12 @@ pub const EventTarget = struct {
4848

4949
const Opts = struct {
5050
capture: ?bool,
51+
// We ignore this property. It seems to be largely used to help the
52+
// browser make certain performance tweaks (i.e. the browser knows
53+
// that the listener won't call preventDefault() and thus can safely
54+
// run the default as needed).
55+
passive: ?bool,
5156
once: ?bool, // currently does nothing
52-
passive: ?bool, // currently does nothing
5357
signal: ?bool, // currently does nothing
5458
};
5559
};
@@ -74,7 +78,6 @@ pub const EventTarget = struct {
7478
// better to be explicit and error.
7579
if (o.once orelse false) return error.NotImplemented;
7680
if (o.signal orelse false) return error.NotImplemented;
77-
if (o.passive orelse false) return error.NotImplemented;
7881
capture = o.capture orelse false;
7982
},
8083
}

0 commit comments

Comments
 (0)