EventHandlerSource Class

An event handler content attribute to compile (https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler): the body of a function whose parameters are EventHandlerSource.Parameters, whose scope chain is the global environment of the realm of EventHandlerSource.Window, then EventHandlerSource.Document, EventHandlerSource.Form and EventHandlerSource.Element (when they are not null), and whose this value is the current target of the event.

public sealed class EventHandlerSource

Properties

NameDescription
BodyGets the body of the function: the value of the content attribute.
DocumentGets the document added to the scope chain (the node document of EventHandlerSource.Element), or null when EventHandlerSource.Target is a window.
ElementGets the element added to the scope chain (the element of the content attribute), or null when EventHandlerSource.Target is a window.
FormGets the form owner of EventHandlerSource.Element added to the scope chain, or null.
NameGets the name of the content attribute and of the function (e.g. onclick).
ParametersGets the parameters of the function: event, or event, source, lineno, colno and error for the onerror event handler of a window (an OnErrorEventHandler).
TargetGets the target of the event handler: the element, or the window for the Window-reflecting body element event handlers (e.g. <body onload>).
UrlGets the URL of the document of the content attribute, used as the file name of the errors.
WindowGets the global object of the realm in which the function is created.

Gets the body of the function: the value of the content attribute.

public string Body { get; }

Property value

string

Gets the document added to the scope chain (the node document of EventHandlerSource.Element), or null when EventHandlerSource.Target is a window.

public Document? Document { get; }

Property value

Document?

Gets the element added to the scope chain (the element of the content attribute), or null when EventHandlerSource.Target is a window.

public Element? Element { get; }

Property value

Element?

Gets the form owner of EventHandlerSource.Element added to the scope chain, or null.

public HtmlFormElement? Form { get; }

Property value

HtmlFormElement?

Gets the name of the content attribute and of the function (e.g. onclick).

public string Name { get; }

Property value

string

Gets the parameters of the function: event, or event, source, lineno, colno and error for the onerror event handler of a window (an OnErrorEventHandler).

public IReadOnlyList<string> Parameters { get; }

Property value

IReadOnlyList<string>

Gets the target of the event handler: the element, or the window for the Window-reflecting body element event handlers (e.g. <body onload>).

public EventTarget Target { get; }

Property value

EventTarget

Gets the URL of the document of the content attribute, used as the file name of the errors.

public string Url { get; }

Property value

string

Gets the global object of the realm in which the function is created.

public Window Window { get; }

Property value

Window