DOM

DOM

Source

This construct can be used by Event subclasses that have a more complex structure
than a simple 1:1 mapping between their initializing dictionary members and IDL attributes.

When a constructor of the Event interface, or of an interface that inherits from the Event interface, is invoked, these steps
must be run, given the arguments type and eventInitDict:

  1. Let event be the result of running the inner event creation steps with this interface, null, now, and eventInitDict.

  2. Initialize event’s type attribute to type.

  3. Return event.

To create an event using eventInterface, which must be either Event or an interface that inherits from
it, and optionally given a In macOS the time of the occurrence for input actions is available via the timestamp property of NSEvent objects.

  • Initialize event’s isTrusted attribute to true.

  • Return event.

  • Create an event is meant to be used by other specifications which need to
    separately create and dispatch events, instead of simply firing them. It ensures the event’s attributes are initialized to the
    correct defaults.

    The inner event creation steps, given an interface, realm, time, and dictionary, are as follows:

    1. Let event be the result of creating a new object using eventInterface. If realm is non-null, then use that Realm; otherwise, use the default behavior defined in Web IDL.

      As of the time of this writing Web IDL does not yet define any default behavior; see heycam/webidl#135.

    2. Set event’s initialized flag.

    3. Initialize event’s timeStamp attribute to a DOMHighResTimeStamp representing the high resolution time from the time origin to time.

      User agents should set a minimum resolution of event’s timeStamp attribute to 5 microseconds following the existing clock resolution recommendation. [HR-TIME]

    4. For each member → value in dictionary, if event has an attribute whose identifier is member, then initialize that attribute to value.

    5. Run the event constructing steps with event.

    6. Return event.

    In general, when defining a new interface that inherits from Event please always ask
    feedback from the WHATWG or the W3C WebApps WG community.



    Read Next page

    Report Page