mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #22933 - pngai:implement-returnValue-attribute, r=jdm
Implement historical returnValue attribute for Event interface <!-- Please describe your changes on the following line: --> Implementation of `returnValue` attribute for Event interface. --- <!-- 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 #22881 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22933) <!-- Reviewable:end -->
This commit is contained in:
commit
4d8d54fc00
6 changed files with 13 additions and 42 deletions
|
@ -297,6 +297,18 @@ impl EventMethods for Event {
|
|||
self.cancelable.get()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-returnvalue
|
||||
fn ReturnValue(&self) -> bool {
|
||||
self.canceled.get() == EventDefault::Allowed
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-returnvalue
|
||||
fn SetReturnValue(&self, val: bool) {
|
||||
if !val {
|
||||
self.PreventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-timestamp
|
||||
fn TimeStamp(&self) -> u64 {
|
||||
self.timestamp
|
||||
|
|
|
@ -26,6 +26,7 @@ interface Event {
|
|||
readonly attribute boolean bubbles;
|
||||
[Pure]
|
||||
readonly attribute boolean cancelable;
|
||||
attribute boolean returnValue; // historical
|
||||
void preventDefault();
|
||||
[Pure]
|
||||
readonly attribute boolean defaultPrevented;
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[Event-defaultPrevented.html]
|
||||
[returnValue should change defaultPrevented if cancelable is true.]
|
||||
expected: FAIL
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
[Event-returnValue.html]
|
||||
[When an event is created, returnValue should be initialized to true.]
|
||||
expected: FAIL
|
||||
|
||||
[preventDefault() should not change returnValue if cancelable is false.]
|
||||
expected: FAIL
|
||||
|
||||
[returnValue=false should have no effect if cancelable is false.]
|
||||
expected: FAIL
|
||||
|
||||
[preventDefault() should change returnValue if cancelable is true.]
|
||||
expected: FAIL
|
||||
|
||||
[initEvent should unset returnValue.]
|
||||
expected: FAIL
|
||||
|
||||
[returnValue=true should have no effect once the canceled flag was set.]
|
||||
expected: FAIL
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
[EventTarget-dispatchEvent-returnvalue.html]
|
||||
[Return value of EventTarget.dispatchEvent() affected by preventDefault().]
|
||||
expected: FAIL
|
||||
|
||||
[Return value of EventTarget.dispatchEvent() affected by returnValue.]
|
||||
expected: FAIL
|
||||
|
|
@ -872,9 +872,6 @@
|
|||
[Event interface: operation composedPath()]
|
||||
expected: FAIL
|
||||
|
||||
[Event interface: attribute returnValue]
|
||||
expected: FAIL
|
||||
|
||||
[Event interface: attribute composed]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -884,9 +881,6 @@
|
|||
[Event interface: document.createEvent("Event") must inherit property "composedPath()" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Event interface: document.createEvent("Event") must inherit property "returnValue" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Event interface: document.createEvent("Event") must inherit property "composed" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -896,9 +890,6 @@
|
|||
[Event interface: new Event("foo") must inherit property "composedPath()" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Event interface: new Event("foo") must inherit property "returnValue" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Event interface: new Event("foo") must inherit property "composed" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -911,9 +902,6 @@
|
|||
[Event interface: new CustomEvent("foo") must inherit property "composedPath()" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Event interface: new CustomEvent("foo") must inherit property "returnValue" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Event interface: new CustomEvent("foo") must inherit property "composed" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue