Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow constructing and subclassing EventTarget #467

Merged
merged 2 commits into from
Jul 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ for historical reasons.
<h3 id=interface-eventtarget>Interface {{EventTarget}}</h3>

<pre class=idl>
[Exposed=(Window,Worker)]
[Constructor, Exposed=(Window,Worker)]
interface EventTarget {
void addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options);
void removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options);
Expand Down Expand Up @@ -944,6 +944,11 @@ and a <dfn export for=EventTarget>legacy-canceled-activation behavior</dfn> algo
are not to be used for anything else. [[!HTML]]

<dl class=domintro>
<dt><code><var>target</var> = new <a constructor for=EventTarget lt=EventTarget()>EventTarget</a>();</code>
<dd>
Creates a new {{EventTarget}} object, which can be used by developers to <a>dispatch</a> and listen for
<a>events</a>.

<dt><code><var>target</var> . <a method for=EventTarget lt=addEventListener()>addEventListener</a>(<var>type</var>, <var>callback</var> [, <var>options</var>])</code>
<dd>
Appends an <a>event listener</a> for <a>events</a> whose {{Event/type}} attribute value
Expand Down Expand Up @@ -1014,6 +1019,17 @@ steps:
<li><p>Return <var>capture</var>, <var>passive</var>, and <var>once</var>.
</ol>

<p>The <dfn constructor for=EventTarget><code>EventTarget()</code></dfn> constructor, when invoked,
must return a new {{EventTarget}}.

<p class="note">Because of the defaults stated elsewhere, the returned {{EventTarget}}'s
<a>get the parent</a> algorithm will return null, and it will have no <a>activation behavior</a>,
<a>legacy-pre-activation behavior</a>, or <a>legacy-canceled-activation behavior</a>.

<p class="note">In the future we could allow custom <a>get the parent</a> algorithms. Let us know
if this would be useful for your programs. For now, all author-created {{EventTarget}}s do not
participate in a tree structure.</p>

<p>The
<dfn method for=EventTarget><code>addEventListener(<var>type</var>, <var>callback</var>, <var>options</var>)</code></dfn>
method, when invoked, must run these steps:
Expand Down