mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Fix some of the remove-event-handler problems
This commit is contained in:
parent
6d220d02de
commit
2874c62d35
2 changed files with 9 additions and 10 deletions
|
@ -404,9 +404,15 @@ impl EventTarget {
|
|||
});
|
||||
|
||||
match idx {
|
||||
Some(idx) => {
|
||||
entries[idx].listener =
|
||||
EventListenerType::Inline(listener.unwrap_or(InlineEventListener::Null));
|
||||
Some(idx) => match listener {
|
||||
// Replace if there's something to replace with,
|
||||
// but remove entirely if there isn't.
|
||||
Some(listener) => {
|
||||
entries[idx].listener = EventListenerType::Inline(listener);
|
||||
},
|
||||
None => {
|
||||
entries.remove(idx);
|
||||
},
|
||||
},
|
||||
None => {
|
||||
if let Some(listener) = listener {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue