Class

SafariEvent

The SafariEvent class is a base class used to encapsulate events. Developers who are familiar with DOM events will notice many similarities in design and behavior.

Overview

Events are sent to their target and its ancestors in three phases. In order, they are as follows:

  1. Capturing. The event is sent to every ancestor of its target, starting with the most distant ancestor, and ending with the parent of the event’s target.

  2. Targeting. The event is sent to its target.

  3. Bubbling. The event is sent to every ancestor of its target, starting with the parent of the event’s target, and ending with its most distant ancestor.

You can tell which phase an event is in from the value of its eventPhase property. When you register for an event notification, you specify whether or not you want to be notified during the capturing phase. (You may not always need to check what phase the event is in.) The string used to identify a particular type of event is documented in the reference for that class. See Table 1 for some common event types.

Table 1

Safari event types

Topics

Targeting Events

type

The type of the event.

target

The target of the event.

currentTarget

The object that the event is currently being sent to.

timeStamp

The time and date that the event was created.

Interacting with Event Propagation

eventPhase

The event-handling phase that the event is in.

bubbles

A Boolean value that indicates whether the event goes through the bubbling phase.

cancelable

A Boolean value that indicates whether the event can be canceled.

stopPropagation

Prevents the event from any further propagation.

Preventing the Default Action

preventDefault

Prevents the browser from performing the default action for an event.

defaultPrevented

A Boolean value that indicates whether the event’s default action has been prevented.

Constants

Event-Handling Phases

Phases of the event-handling process.