mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Spec links for script::dom::element & script::dom::event
This commit is contained in:
parent
51dd6984f7
commit
82335a1904
2 changed files with 21 additions and 1 deletions
|
@ -174,55 +174,67 @@ impl Event {
|
|||
}
|
||||
|
||||
impl<'a> EventMethods for JSRef<'a, Event> {
|
||||
// https://dom.spec.whatwg.org/#dom-event-eventphase
|
||||
fn EventPhase(self) -> u16 {
|
||||
self.phase.get() as u16
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-type
|
||||
fn Type(self) -> DOMString {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let type_ = self.type_.borrow();
|
||||
type_.clone()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-target
|
||||
fn GetTarget(self) -> Option<Temporary<EventTarget>> {
|
||||
self.target.get()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-currenttarget
|
||||
fn GetCurrentTarget(self) -> Option<Temporary<EventTarget>> {
|
||||
self.current_target.get()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-defaultprevented
|
||||
fn DefaultPrevented(self) -> bool {
|
||||
self.canceled.get()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-preventdefault
|
||||
fn PreventDefault(self) {
|
||||
if self.cancelable.get() {
|
||||
self.canceled.set(true)
|
||||
}
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-stoppropagation
|
||||
fn StopPropagation(self) {
|
||||
self.stop_propagation.set(true);
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-stopimmediatepropagation
|
||||
fn StopImmediatePropagation(self) {
|
||||
self.stop_immediate.set(true);
|
||||
self.stop_propagation.set(true);
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-bubbles
|
||||
fn Bubbles(self) -> bool {
|
||||
self.bubbles.get()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-cancelable
|
||||
fn Cancelable(self) -> bool {
|
||||
self.cancelable.get()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-timestamp
|
||||
fn TimeStamp(self) -> u64 {
|
||||
self.timestamp
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-initevent
|
||||
fn InitEvent(self,
|
||||
type_: DOMString,
|
||||
bubbles: bool,
|
||||
|
@ -242,6 +254,7 @@ impl<'a> EventMethods for JSRef<'a, Event> {
|
|||
self.cancelable.set(cancelable);
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-istrusted
|
||||
fn IsTrusted(self) -> bool {
|
||||
self.trusted.get()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue