mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #25653 - pshaughn:removeonclick, r=jdm
Make nulling out an inline event handler remove it from the list order Setting a content attribute or IDL attribute to null now removes event handlers like it's supposed to; the removeAttribute case seems to be something deeper which this change doesn't fix. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25196, but not the related #25652 <!-- Either: --> - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
b2f466d9e4
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