Struct script::dom::eventtarget::EventTarget
source · #[repr(C)]pub struct EventTarget {
reflector_: Reflector,
handlers: DomRefCell<HashMapTracedValues<Atom, EventListeners, BuildHasherDefault<FnvHasher>>>,
}
Fields§
§reflector_: Reflector
§handlers: DomRefCell<HashMapTracedValues<Atom, EventListeners, BuildHasherDefault<FnvHasher>>>
Implementations§
source§impl EventTarget
impl EventTarget
fn __assert_parent_type(&self)
source§impl EventTarget
impl EventTarget
pub fn type_id(&self) -> &'static EventTargetTypeId
source§impl EventTarget
impl EventTarget
pub fn new_inherited() -> EventTarget
fn new( global: &GlobalScope, proto: Option<HandleObject<'_>>, can_gc: CanGc, ) -> Root<Dom<EventTarget>>
sourcepub fn has_listeners_for(&self, type_: &Atom) -> bool
pub fn has_listeners_for(&self, type_: &Atom) -> bool
Determine if there are any listeners for a given event type. See https://github.com/whatwg/dom/issues/453.
pub fn get_listeners_for( &self, type_: &Atom, specific_phase: Option<ListenerPhase>, can_gc: CanGc, ) -> Vec<CompiledEventListener>
pub fn dispatch_event(&self, event: &Event, can_gc: CanGc) -> EventStatus
pub fn remove_all_listeners(&self)
sourcefn set_inline_event_listener(
&self,
ty: Atom,
listener: Option<InlineEventListener>,
)
fn set_inline_event_listener( &self, ty: Atom, listener: Option<InlineEventListener>, )
pub fn remove_listener_if_once(&self, ty: &Atom, listener: &Rc<EventListener>)
fn get_inline_event_listener( &self, ty: &Atom, can_gc: CanGc, ) -> Option<CommonEventHandler>
sourcepub fn set_event_handler_uncompiled(
&self,
url: ServoUrl,
line: usize,
ty: &str,
source: DOMString,
)
pub fn set_event_handler_uncompiled( &self, url: ServoUrl, line: usize, ty: &str, source: DOMString, )
Store the raw uncompiled event handler for on-demand compilation later. https://html.spec.whatwg.org/multipage/#event-handler-attributes:event-handler-content-attributes-3
fn get_compiled_event_handler( &self, handler: InternalRawUncompiledHandler, ty: &Atom, can_gc: CanGc, ) -> Option<CommonEventHandler>
pub fn set_event_handler_common<T: CallbackContainer>( &self, ty: &str, listener: Option<Rc<T>>, )
pub fn set_error_event_handler<T: CallbackContainer>( &self, ty: &str, listener: Option<Rc<T>>, )
pub fn set_beforeunload_event_handler<T: CallbackContainer>( &self, ty: &str, listener: Option<Rc<T>>, )
pub fn get_event_handler_common<T: CallbackContainer>( &self, ty: &str, can_gc: CanGc, ) -> Option<Rc<T>>
pub fn has_handlers(&self) -> bool
pub fn fire_event(&self, name: Atom, can_gc: CanGc) -> Root<Dom<Event>>
pub fn fire_bubbling_event(&self, name: Atom, can_gc: CanGc) -> Root<Dom<Event>>
pub fn fire_cancelable_event( &self, name: Atom, can_gc: CanGc, ) -> Root<Dom<Event>>
pub fn fire_bubbling_cancelable_event( &self, name: Atom, can_gc: CanGc, ) -> Root<Dom<Event>>
pub fn fire_event_with_params( &self, name: Atom, bubbles: EventBubbles, cancelable: EventCancelable, can_gc: CanGc, ) -> Root<Dom<Event>>
pub fn add_event_listener( &self, ty: DOMString, listener: Option<Rc<EventListener>>, options: AddEventListenerOptions, )
pub fn remove_event_listener( &self, ty: DOMString, listener: Option<Rc<EventListener>>, options: EventListenerOptions, )
Trait Implementations§
source§impl Castable for EventTarget
impl Castable for EventTarget
source§impl DomObject for EventTarget
impl DomObject for EventTarget
source§impl DomObjectWrap for EventTarget
impl DomObjectWrap for EventTarget
source§const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>, _: CanGc) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::EventTargetBinding::EventTarget_Binding::Wrap as for<'a, 'b> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::eventtarget::EventTarget>, script_runtime::CanGc) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::eventtarget::EventTarget>>}
const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>, _: CanGc) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::EventTargetBinding::EventTarget_Binding::Wrap as for<'a, 'b> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::eventtarget::EventTarget>, script_runtime::CanGc) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::eventtarget::EventTarget>>}
Function pointer to the general wrap function type
source§impl EventTargetMethods for EventTarget
impl EventTargetMethods for EventTarget
fn Constructor( global: &GlobalScope, proto: Option<HandleObject<'_>>, can_gc: CanGc, ) -> Result<Root<Dom<EventTarget>>, Error>
fn AddEventListener( &self, ty: DOMString, listener: Option<Rc<EventListener>>, options: AddEventListenerOptionsOrBoolean, )
fn RemoveEventListener( &self, ty: DOMString, listener: Option<Rc<EventListener>>, options: EventListenerOptionsOrBoolean, )
fn DispatchEvent(&self, event: &Event, can_gc: CanGc) -> Result<bool, Error>
source§impl HasParent for EventTarget
impl HasParent for EventTarget
source§impl IDLInterface for EventTarget
impl IDLInterface for EventTarget
source§impl MallocSizeOf for EventTarget
impl MallocSizeOf for EventTarget
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
source§impl MutDomObject for EventTarget
impl MutDomObject for EventTarget
source§impl PartialEq for EventTarget
impl PartialEq for EventTarget
source§impl ToJSValConvertible for EventTarget
impl ToJSValConvertible for EventTarget
source§impl Traceable for EventTarget
impl Traceable for EventTarget
source§impl VirtualMethods for EventTarget
impl VirtualMethods for EventTarget
source§fn super_type(&self) -> Option<&dyn VirtualMethods>
fn super_type(&self) -> Option<&dyn VirtualMethods>
Returns self as the superclass of the implementation for this trait,
if any.
source§fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation<'_>)
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation<'_>)
Called when attributes of a node are mutated.
https://dom.spec.whatwg.org/#attribute-is-set
https://dom.spec.whatwg.org/#attribute-is-removed
source§fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool
fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool
Returns
true
if given attribute attr
affects style of the
given element.source§fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue
Returns the right AttrValue variant for the attribute with name
name
on this element.source§fn bind_to_tree(&self, context: &BindContext)
fn bind_to_tree(&self, context: &BindContext)
Called when a Node is appended to a tree, where ‘tree_connected’ indicates
whether the tree is part of a Document.
source§fn unbind_from_tree(&self, context: &UnbindContext<'_>)
fn unbind_from_tree(&self, context: &UnbindContext<'_>)
Called when a Node is removed from a tree, where ‘tree_connected’
indicates whether the tree is part of a Document.
Implements removing steps:
https://dom.spec.whatwg.org/#concept-node-remove-ext
source§fn children_changed(&self, mutation: &ChildrenMutation<'_>)
fn children_changed(&self, mutation: &ChildrenMutation<'_>)
Called on the parent when its children are changed.
source§fn handle_event(&self, event: &Event)
fn handle_event(&self, event: &Event)
Called during event dispatch after the bubbling phase completes.
source§fn adopting_steps(&self, old_doc: &Document)
fn adopting_steps(&self, old_doc: &Document)
source§fn cloning_steps(
&self,
copy: &Node,
maybe_doc: Option<&Document>,
clone_children: CloneChildrenFlag,
)
fn cloning_steps( &self, copy: &Node, maybe_doc: Option<&Document>, clone_children: CloneChildrenFlag, )
impl DerivedFrom<EventTarget> for AnalyserNode
impl DerivedFrom<EventTarget> for Attr
impl DerivedFrom<EventTarget> for AudioBufferSourceNode
impl DerivedFrom<EventTarget> for AudioContext
impl DerivedFrom<EventTarget> for AudioDestinationNode
impl DerivedFrom<EventTarget> for AudioNode
impl DerivedFrom<EventTarget> for AudioScheduledSourceNode
impl DerivedFrom<EventTarget> for AudioTrackList
impl DerivedFrom<EventTarget> for BaseAudioContext
impl DerivedFrom<EventTarget> for BiquadFilterNode
impl DerivedFrom<EventTarget> for Bluetooth
impl DerivedFrom<EventTarget> for BluetoothDevice
impl DerivedFrom<EventTarget> for BluetoothPermissionResult
impl DerivedFrom<EventTarget> for BluetoothRemoteGATTCharacteristic
impl DerivedFrom<EventTarget> for BluetoothRemoteGATTService
impl DerivedFrom<EventTarget> for BroadcastChannel
impl DerivedFrom<EventTarget> for CDATASection
impl DerivedFrom<EventTarget> for ChannelMergerNode
impl DerivedFrom<EventTarget> for ChannelSplitterNode
impl DerivedFrom<EventTarget> for CharacterData
impl DerivedFrom<EventTarget> for Comment
impl DerivedFrom<EventTarget> for ConstantSourceNode
impl DerivedFrom<EventTarget> for DedicatedWorkerGlobalScope
impl DerivedFrom<EventTarget> for DissimilarOriginWindow
impl DerivedFrom<EventTarget> for Document
impl DerivedFrom<EventTarget> for DocumentFragment
impl DerivedFrom<EventTarget> for DocumentType
impl DerivedFrom<EventTarget> for Element
impl DerivedFrom<EventTarget> for EventSource
impl DerivedFrom<EventTarget> for EventTarget
impl DerivedFrom<EventTarget> for FileReader
impl DerivedFrom<EventTarget> for FontFaceSet
impl DerivedFrom<EventTarget> for GPUDevice
impl DerivedFrom<EventTarget> for GainNode
impl DerivedFrom<EventTarget> for GlobalScope
impl DerivedFrom<EventTarget> for HTMLAnchorElement
impl DerivedFrom<EventTarget> for HTMLAreaElement
impl DerivedFrom<EventTarget> for HTMLAudioElement
impl DerivedFrom<EventTarget> for HTMLBRElement
impl DerivedFrom<EventTarget> for HTMLBaseElement
impl DerivedFrom<EventTarget> for HTMLBodyElement
impl DerivedFrom<EventTarget> for HTMLButtonElement
impl DerivedFrom<EventTarget> for HTMLCanvasElement
impl DerivedFrom<EventTarget> for HTMLDListElement
impl DerivedFrom<EventTarget> for HTMLDataElement
impl DerivedFrom<EventTarget> for HTMLDataListElement
impl DerivedFrom<EventTarget> for HTMLDetailsElement
impl DerivedFrom<EventTarget> for HTMLDialogElement
impl DerivedFrom<EventTarget> for HTMLDirectoryElement
impl DerivedFrom<EventTarget> for HTMLDivElement
impl DerivedFrom<EventTarget> for HTMLElement
impl DerivedFrom<EventTarget> for HTMLEmbedElement
impl DerivedFrom<EventTarget> for HTMLFieldSetElement
impl DerivedFrom<EventTarget> for HTMLFontElement
impl DerivedFrom<EventTarget> for HTMLFormElement
impl DerivedFrom<EventTarget> for HTMLFrameElement
impl DerivedFrom<EventTarget> for HTMLFrameSetElement
impl DerivedFrom<EventTarget> for HTMLHRElement
impl DerivedFrom<EventTarget> for HTMLHeadElement
impl DerivedFrom<EventTarget> for HTMLHeadingElement
impl DerivedFrom<EventTarget> for HTMLHtmlElement
impl DerivedFrom<EventTarget> for HTMLIFrameElement
impl DerivedFrom<EventTarget> for HTMLImageElement
impl DerivedFrom<EventTarget> for HTMLInputElement
impl DerivedFrom<EventTarget> for HTMLLIElement
impl DerivedFrom<EventTarget> for HTMLLabelElement
impl DerivedFrom<EventTarget> for HTMLLegendElement
impl DerivedFrom<EventTarget> for HTMLLinkElement
impl DerivedFrom<EventTarget> for HTMLMapElement
impl DerivedFrom<EventTarget> for HTMLMediaElement
impl DerivedFrom<EventTarget> for HTMLMenuElement
impl DerivedFrom<EventTarget> for HTMLMetaElement
impl DerivedFrom<EventTarget> for HTMLMeterElement
impl DerivedFrom<EventTarget> for HTMLModElement
impl DerivedFrom<EventTarget> for HTMLOListElement
impl DerivedFrom<EventTarget> for HTMLObjectElement
impl DerivedFrom<EventTarget> for HTMLOptGroupElement
impl DerivedFrom<EventTarget> for HTMLOptionElement
impl DerivedFrom<EventTarget> for HTMLOutputElement
impl DerivedFrom<EventTarget> for HTMLParagraphElement
impl DerivedFrom<EventTarget> for HTMLParamElement
impl DerivedFrom<EventTarget> for HTMLPictureElement
impl DerivedFrom<EventTarget> for HTMLPreElement
impl DerivedFrom<EventTarget> for HTMLProgressElement
impl DerivedFrom<EventTarget> for HTMLQuoteElement
impl DerivedFrom<EventTarget> for HTMLScriptElement
impl DerivedFrom<EventTarget> for HTMLSelectElement
impl DerivedFrom<EventTarget> for HTMLSourceElement
impl DerivedFrom<EventTarget> for HTMLSpanElement
impl DerivedFrom<EventTarget> for HTMLStyleElement
impl DerivedFrom<EventTarget> for HTMLTableCaptionElement
impl DerivedFrom<EventTarget> for HTMLTableCellElement
impl DerivedFrom<EventTarget> for HTMLTableColElement
impl DerivedFrom<EventTarget> for HTMLTableElement
impl DerivedFrom<EventTarget> for HTMLTableRowElement
impl DerivedFrom<EventTarget> for HTMLTableSectionElement
impl DerivedFrom<EventTarget> for HTMLTemplateElement
impl DerivedFrom<EventTarget> for HTMLTextAreaElement
impl DerivedFrom<EventTarget> for HTMLTimeElement
impl DerivedFrom<EventTarget> for HTMLTitleElement
impl DerivedFrom<EventTarget> for HTMLTrackElement
impl DerivedFrom<EventTarget> for HTMLUListElement
impl DerivedFrom<EventTarget> for HTMLUnknownElement
impl DerivedFrom<EventTarget> for HTMLVideoElement
impl DerivedFrom<EventTarget> for IIRFilterNode
impl DerivedFrom<EventTarget> for MediaDevices
impl DerivedFrom<EventTarget> for MediaElementAudioSourceNode
impl DerivedFrom<EventTarget> for MediaQueryList
impl DerivedFrom<EventTarget> for MediaStream
impl DerivedFrom<EventTarget> for MediaStreamAudioDestinationNode
impl DerivedFrom<EventTarget> for MediaStreamAudioSourceNode
impl DerivedFrom<EventTarget> for MediaStreamTrack
impl DerivedFrom<EventTarget> for MediaStreamTrackAudioSourceNode
impl DerivedFrom<EventTarget> for MessagePort
impl DerivedFrom<EventTarget> for Node
impl DerivedFrom<EventTarget> for OfflineAudioContext
impl DerivedFrom<EventTarget> for OffscreenCanvas
impl DerivedFrom<EventTarget> for OscillatorNode
impl DerivedFrom<EventTarget> for PaintWorkletGlobalScope
impl DerivedFrom<EventTarget> for PannerNode
impl DerivedFrom<EventTarget> for Performance
impl DerivedFrom<EventTarget> for PermissionStatus
impl DerivedFrom<EventTarget> for ProcessingInstruction
impl DerivedFrom<EventTarget> for RTCDataChannel
impl DerivedFrom<EventTarget> for RTCPeerConnection
impl DerivedFrom<EventTarget> for SVGElement
impl DerivedFrom<EventTarget> for SVGGraphicsElement
impl DerivedFrom<EventTarget> for SVGSVGElement
impl DerivedFrom<EventTarget> for ServiceWorker
impl DerivedFrom<EventTarget> for ServiceWorkerContainer
impl DerivedFrom<EventTarget> for ServiceWorkerGlobalScope
impl DerivedFrom<EventTarget> for ServiceWorkerRegistration
impl DerivedFrom<EventTarget> for ShadowRoot
impl DerivedFrom<EventTarget> for StereoPannerNode
impl DerivedFrom<EventTarget> for TestWorkletGlobalScope
impl DerivedFrom<EventTarget> for Text
impl DerivedFrom<EventTarget> for TextTrack
impl DerivedFrom<EventTarget> for TextTrackCue
impl DerivedFrom<EventTarget> for TextTrackList
impl DerivedFrom<EventTarget> for VTTCue
impl DerivedFrom<EventTarget> for VideoTrackList
impl DerivedFrom<EventTarget> for WebSocket
impl DerivedFrom<EventTarget> for Window
impl DerivedFrom<EventTarget> for Worker
impl DerivedFrom<EventTarget> for WorkerGlobalScope
impl DerivedFrom<EventTarget> for WorkletGlobalScope
impl DerivedFrom<EventTarget> for XMLDocument
impl DerivedFrom<EventTarget> for XMLHttpRequest
impl DerivedFrom<EventTarget> for XMLHttpRequestEventTarget
impl DerivedFrom<EventTarget> for XMLHttpRequestUpload
impl DerivedFrom<EventTarget> for XRBoundedReferenceSpace
impl DerivedFrom<EventTarget> for XRCompositionLayer
impl DerivedFrom<EventTarget> for XRCubeLayer
impl DerivedFrom<EventTarget> for XRCylinderLayer
impl DerivedFrom<EventTarget> for XREquirectLayer
impl DerivedFrom<EventTarget> for XRJointSpace
impl DerivedFrom<EventTarget> for XRLayer
impl DerivedFrom<EventTarget> for XRProjectionLayer
impl DerivedFrom<EventTarget> for XRQuadLayer
impl DerivedFrom<EventTarget> for XRReferenceSpace
impl DerivedFrom<EventTarget> for XRSession
impl DerivedFrom<EventTarget> for XRSpace
impl DerivedFrom<EventTarget> for XRSystem
impl DerivedFrom<EventTarget> for XRWebGLLayer
impl Eq for EventTarget
Auto Trait Implementations§
impl !Freeze for EventTarget
impl !RefUnwindSafe for EventTarget
impl !Send for EventTarget
impl !Sync for EventTarget
impl Unpin for EventTarget
impl !UnwindSafe for EventTarget
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert