mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +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 {
|
match idx {
|
||||||
Some(idx) => {
|
Some(idx) => match listener {
|
||||||
entries[idx].listener =
|
// Replace if there's something to replace with,
|
||||||
EventListenerType::Inline(listener.unwrap_or(InlineEventListener::Null));
|
// but remove entirely if there isn't.
|
||||||
|
Some(listener) => {
|
||||||
|
entries[idx].listener = EventListenerType::Inline(listener);
|
||||||
|
},
|
||||||
|
None => {
|
||||||
|
entries.remove(idx);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
if let Some(listener) = listener {
|
if let Some(listener) = listener {
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
[event-handler-removal.window.html]
|
[event-handler-removal.window.html]
|
||||||
[Event handler set through content attribute should be deactivated when the content attribute is removed.]
|
[Event handler set through content attribute should be deactivated when the content attribute is removed.]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[Event handler set through IDL should be deactivated when the IDL attribute is set to null.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Event handler set through content attribute should be removed when they are set to null.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue