Skip to content

Commit aa73c4d

Browse files
committed
[cssom-view] Update {add,remove}Listener() to hook into DOM correctly
Fixes #4407.
1 parent fdf5ea1 commit aa73c4d

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

cssom-view-1/Overview.bs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,8 @@ When asked to <dfn>evaluate media queries and report changes</dfn> for a {{Docum
771771
interface MediaQueryList : EventTarget {
772772
readonly attribute CSSOMString media;
773773
readonly attribute boolean matches;
774-
void addListener(EventListener? listener);
775-
void removeListener(EventListener? listener);
774+
void addListener(EventListener? callback);
775+
void removeListener(EventListener? callback);
776776
attribute EventHandler onchange;
777777
};
778778
</pre>
@@ -783,22 +783,24 @@ the associated <a>media</a>.
783783
The <dfn attribute for=MediaQueryList>matches</dfn> attribute must return
784784
the associated <a>matches state</a>. <!--fingerprint-->
785785

786-
The <dfn method for=MediaQueryList>addListener(<var>listener</var>)</dfn> method must run these steps:
786+
The <dfn method for=MediaQueryList>addListener(<var>callback</var>)</dfn> method,
787+
when invoked, must run these steps:
787788

788-
1. If <var>listener</var> is null, terminate these steps.
789-
1. Append an <a>event listener</a> to the associated list of <a>event listeners</a>
790-
with <b>type</b> set to <code>change</code>,
791-
<b>callback</b> set to <var>listener</var>,
792-
and <b>capture</b> set to false,
793-
unless there already is an <a>event listener</a> in that list
794-
with the same <b>type</b>, <b>callback</b>, and <b>capture</b>.
789+
1. <a spec=dom>Add an event listener</a> with the <a spec=dom>context object</a>
790+
and an <a spec=dom>event listener</a> whose
791+
<a spec=dom for="event listener">type</a> is <code>change</code>,
792+
and <a spec=dom for="event listener">callback</a> is |callback|.
795793

796-
The <dfn method for=MediaQueryList>removeListener(<var>listener</var>)</dfn> method must run these steps:
794+
The <dfn method for=MediaQueryList>removeListener(<var>callback</var>)</dfn> method,
795+
when invoked, must run these steps:
797796

798-
1. Remove an <a>event listener</a> from the associated list of <a>event listeners</a>,
799-
whose <b>type</b> is <code>change</code>,
800-
<b>callback</b> is <var>listener</var>,
801-
and <b>capture</b> is false.
797+
1. If the <a spec=dom>context object</a>’s <a spec=dom for=EventTarget>event listener list</a>
798+
<a for=list>contains</a> an <a>event listener</a> whose
799+
<a spec=dom for="event listener">type</a> is <code>change</code>,
800+
<a spec=dom for="event listener">callback</a> is |callback|,
801+
and <a spec=dom for="event listener">capture</a> is false,
802+
then <a spec=dom>remove an event listener</a> with
803+
the <a spec=dom>context object</a> and that <a spec=dom>event listener</a>.
802804

803805
Note: This specification initially had a custom callback mechanism with {{addListener()}} and
804806
{{removeListener()}}, and the callback was invoked with the associated media query list as argument.

0 commit comments

Comments
 (0)