-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for passing event options #3769
base: main
Are you sure you want to change the base?
Conversation
📊 Tachometer Benchmark ResultsSummaryduration
usedJSHeapSize
Results02_replace1k
duration
usedJSHeapSize
run-warmup-0
run-warmup-1
run-warmup-2
run-warmup-3
run-warmup-4
run-final
03_update10th1k_x16
duration
usedJSHeapSize
07_create10k
duration
usedJSHeapSize
filter_list
duration
usedJSHeapSize
hydrate1k
duration
usedJSHeapSize
many_updates
duration
usedJSHeapSize
text_update
duration
usedJSHeapSize
todo
duration
usedJSHeapSize
|
Size Change: +327 B (0%) Total Size: 53.4 kB
ℹ️ View Unchanged
|
@@ -90,12 +90,17 @@ export function setProperty(dom, name, value, oldValue, isSvg) { | |||
else name = name.slice(2); | |||
|
|||
if (!dom._listeners) dom._listeners = {}; | |||
if (!useCapture && Array.isArray(value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens here when the user changes from passive to active? We would need to re-register the event-handler which might be unexpected that we aren't doing that. It did make me wonder whether the -capture
would be a good fit for the -passive
as well. The only other options are once
and signal
which I am not sure would fit here reliably....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JoviDeCroock According to MDN only the capture
option is checked for matching event listeners. See: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener#matching_event_listeners_for_removal
Marking as a draft, because browsers seems to turn scroll events into passive automatically in all browsers. Seems like the chrome DevTools warning is outdated? The passive option was the only reason going for implementing it. Leaving it here in case of future considerations. |
touchstart
,touchmove
andwheel
handlers passive by default, see: https://github.com/facebook/react/blob/main/packages/react-dom-bindings/src/events/DOMPluginEventSystem.js?rgh-link-date=2022-10-15T11%3A29%3A18Z#L432-L447Example:
Fixes #428 .