Auto merge of #24144 - stephenmuss:event-src-element, r=jdm

Event src element

<!-- Please describe your changes on the following line: -->
This builds on top of the work done in https://github.com/servo/servo/pull/22918

---
<!-- 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 #22880
- [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. -->

<!-- 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/24144)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-09-05 23:41:15 -04:00 committed by GitHub
commit da237b4517
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 6 additions and 74 deletions

View file

@ -263,6 +263,11 @@ impl EventMethods for Event {
self.target.get()
}
// https://dom.spec.whatwg.org/#dom-event-srcelement
fn GetSrcElement(&self) -> Option<DomRoot<EventTarget>> {
self.target.get()
}
// https://dom.spec.whatwg.org/#dom-event-currenttarget
fn GetCurrentTarget(&self) -> Option<DomRoot<EventTarget>> {
self.current_target.get()

View file

@ -11,6 +11,7 @@ interface Event {
[Pure]
readonly attribute DOMString type;
readonly attribute EventTarget? target;
readonly attribute EventTarget? srcElement;
readonly attribute EventTarget? currentTarget;
const unsigned short NONE = 0;

View file

@ -1,7 +0,0 @@
[Event-constructors.html]
[Event constructors 2]
expected: FAIL
[Event constructors 3]
expected: FAIL

View file

@ -1,7 +0,0 @@
[Event-defaultPrevented-after-dispatch.html]
[Default prevention via preventDefault]
expected: FAIL
[Default prevention via returnValue]
expected: FAIL

View file

@ -1,4 +0,0 @@
[Event-dispatch-detached-click.html]
[Click event can be dispatched to an element that is not in the document.]
expected: FAIL

View file

@ -1,4 +0,0 @@
[Event-dispatch-other-document.html]
[Custom event on an element in another document]
expected: FAIL

View file

@ -1,15 +0,0 @@
[Event-initEvent.html]
type: testharness
[Properties of initEvent(type, true, true)]
expected: FAIL
[Properties of initEvent(type, true, false)]
expected: FAIL
[Properties of initEvent(type, false, true)]
expected: FAIL
[Properties of initEvent(type, false, false)]
expected: FAIL

View file

@ -5,12 +5,8 @@
[throws if `handleEvent` is not callable]
expected: FAIL
[calls `handleEvent` method of `EventListener`]
expected: FAIL
[throws if `handleEvent` is falsy and not callable]
expected: FAIL
[throws if `handleEvent` is thruthy and not callable]
expected: FAIL

View file

@ -2,9 +2,6 @@
[AbortController interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[Event interface: new CustomEvent("foo") must inherit property "srcElement" with the proper type]
expected: FAIL
[Event interface: new Event("foo") must inherit property "composed" with the proper type]
expected: FAIL
@ -20,9 +17,6 @@
[AbortController interface object name]
expected: FAIL
[Event interface: new Event("foo") must inherit property "srcElement" with the proper type]
expected: FAIL
[Event interface: attribute composed]
expected: FAIL
@ -47,9 +41,6 @@
[EventTarget interface: new AbortController().signal must inherit property "dispatchEvent(Event)" with the proper type]
expected: FAIL
[Event interface: attribute srcElement]
expected: FAIL
[EventTarget interface: calling addEventListener(DOMString, EventListener, [object Object\],[object Object\]) on new AbortController().signal with too few arguments must throw TypeError]
expected: FAIL

View file

@ -199,9 +199,6 @@
[idlharness.window.html?exclude=Node]
[Event interface: new CustomEvent("foo") must inherit property "srcElement" with the proper type]
expected: FAIL
[EventTarget interface: new AbortController().signal must inherit property "addEventListener(DOMString, EventListener, [object Object\],[object Object\])" with the proper type]
expected: FAIL
@ -331,9 +328,6 @@
[AbstractRange interface: attribute endContainer]
expected: FAIL
[Event interface: new Event("foo") must inherit property "srcElement" with the proper type]
expected: FAIL
[AbortController must be primary interface of new AbortController()]
expected: FAIL
@ -346,9 +340,6 @@
[CharacterData interface: operation remove()]
expected: FAIL
[Event interface: attribute srcElement]
expected: FAIL
[Range interface: existence and properties of interface object]
expected: FAIL
@ -532,9 +523,6 @@
[Attr interface: existence and properties of interface prototype object]
expected: FAIL
[Event interface: document.createEvent("Event") must inherit property "srcElement" with the proper type]
expected: FAIL
[Element interface: operation replaceWith([object Object\],[object Object\])]
expected: FAIL

View file

@ -827,27 +827,18 @@
[DOM IDL tests]
expected: FAIL
[Event interface: attribute srcElement]
expected: FAIL
[Event interface: operation composedPath()]
expected: FAIL
[Event interface: attribute composed]
expected: FAIL
[Event interface: document.createEvent("Event") must inherit property "srcElement" with the proper type]
expected: FAIL
[Event interface: document.createEvent("Event") must inherit property "composedPath()" with the proper type]
expected: FAIL
[Event interface: document.createEvent("Event") must inherit property "composed" with the proper type]
expected: FAIL
[Event interface: new Event("foo") must inherit property "srcElement" with the proper type]
expected: FAIL
[Event interface: new Event("foo") must inherit property "composedPath()" with the proper type]
expected: FAIL
@ -857,9 +848,6 @@
[CustomEvent interface: operation initCustomEvent(DOMString, boolean, boolean, any)]
expected: FAIL
[Event interface: new CustomEvent("foo") must inherit property "srcElement" with the proper type]
expected: FAIL
[Event interface: new CustomEvent("foo") must inherit property "composedPath()" with the proper type]
expected: FAIL