-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
script: Clear all associated event listeners when removing an event listener content attribute. #39011
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
Conversation
Signed-off-by: Kot <kot@kot.pink>
81ac758
to
27657f9
Compare
components/script/dom/htmlelement.rs
Outdated
@@ -1135,7 +1135,7 @@ impl VirtualMethods for HTMLElement { | |||
evtarget.remove_event_listener( | |||
event_name.into(), | |||
evtarget.get_event_handler_common(event_name, can_gc), | |||
EventListenerOptions { capture: false }, | |||
None, |
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.
Can you check why the test linked in #38734 (comment) is still failing with this patch? I would expect it to be fixed, which was the original motivation for the issue you linked
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.
I think we should be using set_event_handler_common
instead of remove_event_listener
here? It doesn't make sense to run EventTarget.removeEventListener on inline event listeners (onclick
, etc). Which means we wouldn't need to make options
an Option.
Signed-off-by: Kot <kot@kot.pink>
🔨 Triggering try run (#17337838219) for Linux (WPT) |
Test results for linux-wpt from try job (#17337838219): Flaky unexpected result (23)
Stable unexpected results that are known to be intermittent (25)
Stable unexpected results (1)
|
|
Looks like it passes! Fixing the lint (and WPT) now. |
Signed-off-by: Kot <kot@kot.pink>
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.
Nice!
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.
Thanks for digging into this!
This change allows callers of
remove_event_listener
to specifyNone
for theoptions
argument to skip phase (bubble/capture) checking (and remove either type of listener).Notably, this changes the HTMLElement
attribute_mutated
code to remove all event listeners rather than ones with justcapture: false
, which should be correct behavior.Testing:
mach try linux-wpt
: https://github.com/kotx/servo/actions/runs/17313405730Fixes: #38742