pub struct EventsByNodeIdx { /* private fields */ }
Expand description

Node’s in a VirtualNode tree are indexed depth first, where the first node is index 0, it’s first child node is index 1, and the first child’s first child is index 2.

When we create a DOM node, we store all of it’s closures and all of it’s children’s closures in this map.

We also set a .__nodeIdx property on nodes that have one or more events.

Percy will sometimes use event delegation, and other times attach events directly to DOM elements, depending on the kind of event.

The .__nodeIdx property is used to power event delegation, so that the main event handler can look up the callback.

Cloning

EventsByNodeIdx can be cheaply cloned and passed around. Clones share the same inner data.

Implementations

Create a new EventsByNodeIdx.

Unique for every PercyDom so that if multiple instances of PercyDom are nested their event delegation handlers don’t collide.

Insert a newly tracked event.

Panics

Panics if the event_name is delegated and the event is not, or vice versa.

Insert a newly tracked event.

Panics

Panics if there isn’t an event attrib fn to overwrite.

Remove all of the events from one node ID and add them to another node ID.

Remove a managed event.

Get the event handler for a node.

Remove an event handler.

Remove all event handlers for a node.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.