Skip to content

Commit f930a90

Browse files
committed
Editorial: add "add an event listener" hook
This hook ensures that any special casing in addEventListener() is shared with event handler attributes. Helps with w3c/ServiceWorker#1004.
1 parent 8e754b5 commit f930a90

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

dom.bs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,13 +1038,13 @@ must return a new {{EventTarget}}.
10381038
if this would be useful for your programs. For now, all author-created {{EventTarget}}s do not
10391039
participate in a tree structure.</p>
10401040

1041-
<p>The
1042-
<dfn method for=EventTarget><code>addEventListener(<var>type</var>, <var>callback</var>, <var>options</var>)</code></dfn>
1043-
method, when invoked, must run these steps:
1041+
<p>To <dfn export>add an event listener</dfn> given an <code>EventTarget</code> object
1042+
<var>eventTarget</var>, string <var>type</var>, callback <var>callback</var>, and
1043+
<a for=/>dictionary</a> or boolean <var>options</var>, run these steps:
10441044

10451045
<ol>
10461046
<li>
1047-
<p>If <a>context object</a>'s <a>relevant global object</a> is a {{ServiceWorkerGlobalScope}}
1047+
<p>If <var>eventTarget</var>'s <a>relevant global object</a> is a {{ServiceWorkerGlobalScope}}
10481048
object and its associated <a>service worker</a>'s <a for="service worker">script resource</a>'s
10491049
<a for="service worker">has ever been evaluated flag</a> is set, then <a>throw</a> a
10501050
<code>TypeError</code>.
@@ -1059,13 +1059,21 @@ method, when invoked, must run these steps:
10591059
<li><p>Let <var>capture</var>, <var>passive</var>, and <var>once</var> be the result of
10601060
<a lt="flatten more">flattening more</a> <var>options</var>.
10611061

1062-
<li><p>If <a>context object</a>'s associated list of <a>event listener</a> does not contain an
1062+
<li><p>If <var>eventTarget</var>'s associated list of <a>event listener</a> does not contain an
10631063
<a>event listener</a> whose <b>type</b> is <var>type</var>, <b>callback</b> is <var>callback</var>,
10641064
and <b>capture</b> is <var>capture</var>, then append a new <a>event listener</a> to it, whose
10651065
<b>type</b> is <var>type</var>, <b>callback</b> is <var>callback</var>, <b>capture</b> is
10661066
<var>capture</var>, <b>passive</b> is <var>passive</var>, and <b>once</b> is <var>once</var>.
10671067
</ol>
10681068

1069+
<p class=note>The <a>add an event listener</a> concept exists to ensure
1070+
<a>event handler attributes</a> use the same code path. [[HTML]]
1071+
1072+
<p>The
1073+
<dfn method for=EventTarget><code>addEventListener(<var>type</var>, <var>callback</var>, <var>options</var>)</code></dfn>
1074+
method, when invoked, must <a>add an event listener</a> with the <a>context object</a>,
1075+
<var>type</var>, <var>callback</var>, and <var>options</var>.
1076+
10691077
<p>The
10701078
<dfn method for=EventTarget><code>removeEventListener(<var>type</var>, <var>callback</var>, <var>options</var>)</code></dfn>
10711079
method, when invoked, must, run these steps

0 commit comments

Comments
 (0)