implement historical srcElement attribute for Event interface

This commit is contained in:
drexler 2019-02-28 12:55:09 -05:00 committed by Stephen Muss
parent e81af16de8
commit d721dcbd45
No known key found for this signature in database
GPG key ID: 99B28E9E809D9A42
7 changed files with 6 additions and 27 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 +1,4 @@
[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

@ -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

@ -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